Lab 13: Read words from file
Quiz: question similar to those in the assigned reading from Zybooks 9.1-9.2
Activity in Zybooks 9.15: Read in words from a file, print the length of words, and display a random word
There are two files named month.txt and day.txt. Each file contains one word per line.
Write the code to read one of the files, choose a random word from that file, and print the word with its length.
Consider these examples:
Prompt
Input
Output
Enter month.txt or day.txt:
day.txt
Random word is: Thursday with length 8
Enter month.txt or day.txt:
month.txt
Random word is: September with length 9
*Remember to use random_word.strip() to remove the return character at the end. Without it, your program will count an additional character (\n).