##Here's an example of what I've been working on: ##so far I've used num set to zero and num set to the full num=int(input statement... I've learned both ways so far and I'm not sure if I need to use it at all, but when I do it's usually for when I have a for statement asking to keep track of for x in range (0, inp+1): which I've already tried to no avail...
##okay, so here's what I've been trying to do for THREE days now... and it will drive me crazy till I get this! I'm trying to get the program to give output while true (that num is not equal to 11; if not equal to 11, print "nope"; if nope isn't printed, it's supposed to go on to the next statement, etc., etc., until it hits 11. But here's the thing. It's SUPPOSED to try the first statement while true, and change each time through the loop! I have a bunch of other ways I've tried this while racking my brain over it and haven't gotten it QUITE right yet so here's the basic nitty-gritty:
num=0
while num != 11:
num=int(input("Please enter a number from 1 to 20 (17 to stop): "))
print(num)
if num != 11:
print("nope")
elif num >=3:
print("history")
elif num < 20:
print("bye")
elif num > 12:
print("cat")
elif num >= 7:
print("push")
else:
print("sat")```
Aucun commentaire:
Enregistrer un commentaire