Question
In python , code the following. High school assignment, please keep simple - no arrays Instructions: Instructions In the file KnockKnock.txt (please see contents of
In python, code the following. High school assignment, please keep simple - no arrays
Instructions:
Instructions
In the file KnockKnock.txt (please see contents of this file below), the odd lines have the answers to, "Whos there?', and the even numbers have the answers to, "_________ who?" question.
Count the number of lines in the file, then generate a random knock-knock joke from the file.
Sample Run
Note: the extra lines are there because each line ends in a and students will not know how to cut those off yet.)
Knock-Knock
Who's there?
Rabbit
Rabbit
who?
Rabbit up carefully it's a present!
Hint
You may need to open and close the file more than once.
Contents of KnockKnock.txt:
Nobel
No bell, that's why I knocked!
Boo
I didn't mean to make you cry! It's just me!
Will
Will you let me in? It's freezing out here!
Barbie
Barbie Q Chicken!
Figs
Figs the doorbell, it's broken!
Kiwi
Kiwi go to the store?
Lettuce
Lettuce in, we're freezing!
Olive
Olive right next door to you.
Turnip
Turnip the volume, it's quiet in here.
Ice cream
Ice cream if you don't let me in!
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