Question
Please note this is a high school python assignment. Please keep this simple - no arrays Random Joke Generator Instructions In this assignment, you will
Please note this is a high school python assignment. Please keep this simple - no arrays
Random Joke Generator
Instructions
In this assignment, you will write a program that will process data in the jokes.txt (please see contents of file below) and answers.txt (please see contents of file below) files. Set up your program so that it will do the following tasks:
- Displays the number of jokes in jokes.txt
- Asks the user for the number of a joke
- Displays the joke
- Displays the requested joke
- Displays the requested answer
Use the answers_filepath and jokes_filepath variables to open the files and solve this problem.
Sample Run
There are 10 jokes
Which joke do you want to see? 7
Joke #7
How did the teacher knit a suit of armor?
She used steel wool!
Contents of jokes.txt file:
What did the paper say to the pencil?
What did the computer do at lunchtime?
What does a baby computer call his father?
Two bytes meet. The first byte asks, "Are you ill?"
What did you learn in school today?
Which bet can't be won?
How did the teacher knit a suit of armor?
Why did the boy study on an airplane?
What do you call a pig that knows karate?
Why did the chicken cross the playground?
Contents of answers.txt file:
Write on!
It had a byte
Data
The second byte replies, "No, just feeling a bit off."
Not enough, I have to go back tomorrow!
Alphabet.
She used steel wool!
He wanted to get a higher education.
A pork chop!
To get to the other slide.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started