+ 1

Just wanted to show my funny appbreaking code

action = str(input()) start = 100 while start < 10000: if action == str("hit"): print(start + 10) elif action == str("miss"): print(start - 20) I dont know what i did but it repeats "Oops something went wrong, we could not complet this request. Try again." I may not have the right decision but atleast i broke the app hehe

6th Jan 2022, 8:56 PM
Sasha Krömtz
3 Antworten
+ 2
action = input() start = 100 while start>0 : if action=="hit": start +=10 elif action=="miss": start -=20 print(action, start) try: action = input() except EOFError: break https://code.sololearn.com/cC1nzz10Qqe5
6th Jan 2022, 9:47 PM
SoloProg
SoloProg - avatar
+ 1
If you have an endless loop the program automatically ends after a while.
6th Jan 2022, 8:59 PM
Stefanoo
Stefanoo - avatar
0
G'day Sasha Krömtz that looks like a number guessing game, right? Did you write it in python (could you tag the language on your post when you ask a question)? Your pduedo code seems to be: Get word input from user. Start a loop Compare word to hit/miss Print (loop seed number) Things to improve: You don't adjust your loop seed number (start), so your loop doesn't increment. You don't have code to catch input that isn't "hit" or "miss". You don't have instructions for what the input needs to be! Action: Would you write out your psuedocode again so your program makes sense, and we can help you review it?
6th Jan 2022, 9:26 PM
HungryTradie
HungryTradie - avatar