CS 303e - Practice with Dictionaries,
Strings and Graphics
1. Write a function makeDictionary() that takes the name of an input
file as its argument. Your function creates and returns a
dictionary that contains each lowercase character in the alphabet as a
key ('a', 'b', 'c', ...); the value of each key is the number of
occurrences of that character in the input file. Write a main function
that prompts the user for the name of the input file, calls
makeDictionary(), and then prints the number of occurrences of each
lowercase character that occurs at least once.
Hint: You will need to use the chr and ord functions, as well as the
isalpha() and islower() string methods.
2. Write a function doubleIt(st) that takes a string st and returns a
string that contains two copies of each character in st. E.g.,
doubleIt('hello') returns 'hheelllloo'. Write a main function that
prompts the user to enter strings until they enter "stop", and for each
string entered, call doubleIt() on the string, and print the returned
Enter a string, or "stop" to quit: hello
Enter a string, or "stop" to quit: ack
Enter a string, or "stop" to quit: stop
3. Write a program that creates a graphical window with a
cyan background. Create a yellow square, a thick red line, and 3
circles of different colors and sizes, and draw them on the window.