I'm using Python3 and I'm writing this code where it tells you a joke and asks the user if they like it. If yes, then it will print something then the program is finished. If no it will keep on telling new jokes randomly until the user says 'yes'. However, the program does run wihtout any errors, so I'm not sure what the problem is.
here's my code:
import time
import string
import random
def newjoke(joke):
time.sleep(1)
print ("Well what about this:\n\n",joke)
time.sleep(0.5)
funny = input("Did you find that funny?").lower()
return funny
jokes = ["What do you call a boomerang that won't come back?\n\nA stick\n","What's the difference between ‘Oooh’ and ‘Aaah’?\n\nAbout 3 inches\n","Why do most women pay more attention to their appearance than improving their minds?\n\nBecause most men are stupid but few are blind\n","How do you tell a male chromosome from a female chromosome?\n\nPull down its genes","What do you call a fake spaghetti?\n\nAn im-pasta\n","What did the yoga instructor say to her landlord when he tried to evict her?\n\n'Namaste'\n"]
print ("Welcome to the Joke game")
time.sleep(1)
print ("You will be told a joke and it's answer")
time.sleep(1)
print ("Then you have to put in if you found it funny or not - yes/no\n")
time.sleep(3)
print ("What's the point in pushing an envelope?\n\nThere's no point because it's always going to be stationary!\n")
while True:
time.sleep(3)
funny = input("\nDid you find that funny?\n").lower()
if funny == "no":
joke = random.choice(jokes)
funny = newjoke(joke)
if funny == "yes":
time.sleep(0.5)
print ("\nI know, I'm a comedian")
break
---
As you can see in the variable jokes I have a few jokes there (I am going to add more) but when I run the code after 2/3 enters of 'no' it displays blank/nothing then asks if I found it funny. Can you please help me, thanks.
What I have tried:
I have tried to replace the jokes with something shorter eg: "yo","lol","fun" and see if I could identify the problem. But the same thing happened.
I have also tried re-typing it, making sure there's no extra spaces or quotation marks.
So if anyone knows how to fix this, it would be much appreciated.