Home » PythonPi Bonus Lessons » PythonPi Bonus: Knock Knock

PythonPi Bonus: Knock Knock

Today we are going to be playing with user input but not really paying much attention to what is said in the user input. We will be using the user input to move on to the next part of the program. This will take part by being the response in a given knock knock joke.

For example, a knock knock joke would go:

Computer: Knock Knock
User: Who’s there
Computer: Doctor
User: Doctor Who
Computer: Exterminate!

To make a program that will accept input as anything, because we aren’t going to compare anything, the user may reply anything to each part of the joke, we just want to print out the next part of the joke, each time the user responds:

print ‘Knock Knock’
varInput = raw_input()
print ‘Doctor’
varInput = raw_input()
print ‘Exterminate’


Leave a comment

Your email address will not be published. Required fields are marked *