CPSC120 Lab 6


  1. Palindrome

    Create a Python program called palindrome.py that prompts the user for text and prints whether the text is a palindrome. A palindrome is a string that is the same forward and backward. The program should ingnore all non-alphabetic characters and ignore the case of alphabetic characters.

  2. Flesch-Kincaid Reading Level

    Create a program in a file called reading_level.py that prompts the users to enter a string and then prints the Flesch-Kincaid grade level of the entered text. The Flesch-Kincaid grade level is a numeric score that indicates the minimum grade level in which an average student would be able to understand a text. Some states require that legal documents not be written above a certain grade level. The Flesch-Kincaid grade level equation requires determining the number of syllables in a sentence, which is very difficult for a program to compute without a dictionary. The following equation is an approximation to the Flesch-Kincaid grade level that does not use syllables:

    0. 39 * (W / S) + 11. 8 * ((L / 3) / W) − 15. 59

    Where W is the total number of words, S is the total number of sentences, and L is the total number of letters. Assume that all sentences end in a period, that all words are separated by a space, and that only alphabetic characters are letters.

    The files ny_times.txt and seuss.txt contain text from the New York Times and text written by Dr. Seuss. Use redirection to compare the reading level of some of your writing to the New York Times and to Dr. Seuss. You can use these files as input to your program by using redirection as follows:

    python3 reading_level.py < ny_times.txt

  3. Base Conversion

    Create a Python program in a file called binary.py. The program should prompt the user to enter a number that is greater than -1 and less than 1024 and print the binary equivalent of the entered number.


Submit a zip file of your code on the course Inquire site that uses your last names as the file name.