Choose one of the following Cases, clone the lab, work out your case, then upload your solution to the lab page, state your name and case number.
-
Using List and Dictionaries in Python, write a program that reads in a Python source code file and counts the occurrence of each keyword in the file. Your program should prompt the user to enter the Python source code filename.
-
Write a program that will count the number of characters, words, and lines in a file. Words are separated by a whitespace character. Your program should prompt the user to enter a filename.
-
Suppose that a text file contains an unspecified number of scores. Write a program that reads the scores from the file and displays their total and average. Scores are separated by blanks. Your program should prompt the user to enter a filename.
4.Write a program that writes 100 integers created randomly into a file. Integers are separated by a space in the file. Read the data back from the file and display the sorted data. Your program should prompt the user to enter a filename. If the file already exists, do not override it.
-
Suppose a file is encrypted using the scheme in Exercise 13.8. (page No.453) Write a program to decode an encrypted file. Your program should prompt the user to enter an input filename and an output filename and should save the unencrypted version of the input file to the output file.
-
Write a program that prompts the user to enter a text file, reads words from the file, and displays all the nonduplicate words in ascending order.
-
Write a program that prompts the user to enter a text filename and displays the number of vowels and consonants in the file. Use a set to store the vowels A, E, I, O, and U.
-
Write a recursive function that returns the largest integer in a list. Write a test program that prompts the user to enter a list of integers and displays the largest element.
-
Write a recursive function to return the number of uppercase letters in a string using the following function headers: def countUppercase(s): def countUppercaseHelper(s, high): Write a test program that prompts the user to enter a string and displays the number of uppercase letters in the string.
-
Write a recursive function that converts a decimal number into a binary number as a string. The function header is as follows: def decimalToBinary(value): Write a test program that prompts the user to enter a decimal number and displays its binary equivalent.
-
Write a program that prompts the user to enter a directory and displays the number of files in the directory.
-
The Hilbert curve, first described by German mathematician David Hilbert in 1891, is a space-filling curve that visits every point in a square grid with a size of 2 * 2, 4 * 4, 8 * 8, 16 * 16 or any other power of 2. Write a program that displays a Hilbert curve for the specified order, as shown in Figure:

-
Modify the Rational class in Listing 8.4(find it in our learning textbook), Rational.py, to throw a RuntimeError exception if the denominator is 0.