Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ChatBotProject1/knock.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
232 lines (173 sloc)
5.46 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
def knock(a): | |
print("Knock Knock Jokes!") | |
print("User must reply correctly for the joke to continue") | |
print("Note:") | |
print("You will have to reply like whos there(caps don't matter), and John who. If you spell incorrectly it will count as an incorrect try") | |
ranchoice = (randint (1,6)) | |
if ranchoice == 1: | |
joke1(1) | |
elif ranchoice == 2: | |
joke2(1) | |
elif ranchoice == 3: | |
joke3(1) | |
elif ranchoice == 4: | |
joke4(1) | |
elif ranchoice == 5: | |
joke5(1) | |
def joke1(x): | |
print("Knock Knock?") | |
x= str(input("You: ")) | |
x = x.lower() | |
trycounter = 0 | |
while x != "whos there": | |
trycounter = trycounter + 1 | |
x = str(input("You: ")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x =="whos there": | |
print("Nana") | |
x = str(input("You: ")) | |
x = x.lower() | |
if x != "nana who": | |
while x != "nana who": | |
trycounter = trycounter + 1 | |
x= str(input("You :")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "nana who": | |
r = "Nana Your Business!!!" | |
print (r) | |
return 0 | |
def joke2(x): | |
print("Knock Knock?") | |
x= str(input("You :")) | |
x = x.lower() | |
trycounter = 0 | |
while x != "whos there": | |
trycounter = trycounter + 1 | |
x= str(input("You :")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "whos there": | |
print("Needle!") | |
x = str(input("You :")) | |
x = x.lower() | |
while x != "needle who": | |
trycounter = trycounter + 1 | |
x= str(input("You :")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "needle who": | |
r = "I needle money to pay down my debts!!!" | |
print (r) | |
return 0 | |
def joke3(x): | |
print("Knock Knock?") | |
x= str(input("You: ")) | |
x = x.lower() | |
trycounter = 0 | |
while x != "whos there": | |
trycounter = trycounter + 1 | |
x= str(input("You: ")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "whos there": | |
print("Opportunity!") | |
x = str(input("You: ")) | |
x = x.lower() | |
while x != "opportunity who": | |
trycounter = trycounter + 1 | |
x= str(input("You: ")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "opportunity who": | |
r = "Don't be silly you know opportunity doesn't knock twice!!!" | |
print (r) | |
return 0 | |
def joke4(x): | |
print("Knock Knock?") | |
x= str(input("You: ")) | |
x = x.lower() | |
trycounter = 0 | |
while x != "whos there": | |
trycounter = trycounter + 1 | |
x= str(input("You: ")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "whos there": | |
print("Ireland!") | |
x = str(input("You :")) | |
x = x.lower() | |
while x != "ireland who": | |
trycounter = trycounter + 1 | |
x= str(input("You :")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "ireland who": | |
r = "Ireland you some money if you promise to pay it back!!!!" | |
print (r) | |
return 0 | |
def joke5(x): | |
print("Knock Knock?") | |
x= str(input("You: ")) | |
x = x.lower() | |
trycounter = 0 | |
while x != "whos there": | |
trycounter = trycounter + 1 | |
x= str(input("You: ")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "whos there": | |
print(" Money!") | |
x = str(input("You: ")) | |
x = x.lower() | |
while x != "money who": | |
trycounter = trycounter + 1 | |
x= str(input("You: ")) | |
x = x.lower() | |
if trycounter >= 3: | |
print("Come on just play along its fun!") | |
if trycounter >= 7: | |
print("Fine get your giggles elsewhere!") | |
return 0 | |
if x == "money who": | |
r = "My Knee hurts when I run!!!" | |
print (r) | |
return 0 |