There exists a file of ‘Knock Knock’ jokes. The file consists of line pairs. The first element of each pair contains the setup line, and the second element contains the punch line. Here are a few lines from the file:
Amish
Amish you when you are away.
Snow
Snowbody but me!
Toby
Toby or not to be, that is the question.
Dishwasher
Dishwasher ish a bit shtronger than I exshpected.

I need to write a program that reads a file and then loops, randomly picking jokes and then promting the user with the statement "Knock Knock". Then the user is to pick the correct response for what they want to use.
Then for it to ask the user if they would like to hear another joke or quit out of the program

I need some guidence in how to do this question

Thanks guys

Go from small to big in implementation, from the whole to parts in writing the pseudo code of things to do. Read the pseudo code and play stupid (i.e. computer), can you arrive in solution or did you miss something? Implement function, do test in main routine to test it or call it with prepared inputs from command line of your preferred IDE.

For random choice good choise is choice from random

import random
random.choice(['a','b','c'])
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.