0

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

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by pyTony
0

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'])

Edited by pyTony: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.