+ 1
Any idea why this program will not run on my CPU? It runs here.
#The term 'Booleans' sounds like a tribe of ghosts. Enter T for True or F for False. x = input() while x == "T": print("True \nBoo! \nI ain\'t afraid of no ghost!") while x == "F": print("False \nThat\'s exactly what a ghost would say.") else: print("Ghosts just don\'t understand. \nEnter T for True or F for False. \nThe program is case sensitive. \nBe careful, you Boolians ;-)") #Warning: When the program is used as instructed, it results in an infinite loop.
6 Respuestas
+ 1
It's kinda a poem. I want it to be an infinite loop.
+ 1
It should run right?
+ 1
Ooo I like that
0
The last comment is probably letting you know what the problem is.
Solution: Hmmm.... do you know how to break an infinite loop?
{edit: you could also move the input line inside the while loop, but you will have to force a value for x above the while loop. I can explain or show you if that wasn't clear}
0
I'm pasting it from a word processor. Maybe that's it?
0
Oh, the while statements probably should be if elif
x='boo' #or whatever...
while x:
x=input()
if x=='T':
### the print line
elif x=='F':
# the other print line
elif x==("The keymaster!!!"):
break #this will exit the loop, but punctuation and capitals must match exactly!
else:
#the instructions print line.
#that will loop infinitely but will ask for input on each loop. Secret exit phrase is V1.1
https://code.sololearn.com/c0tHWk5M7ZwC/?ref=app