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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!