+ 1
Unexpected indent?
Hi, I'm currently making a Hangman game in Python and I've got an unexpected indent error, but I'm not sure why? (The error is where I've put hashtags (there aren't hashtags in the actual script)) def get_num_attempts(): ##################################### while True: try: num_attempts = int(input("How many incorrect attempts do you want (1 - 25) ? ")) if 1<= num_attempts <= 25: print("Ok!", (num_attempts), "it is!") break else: print("Invalid input. Please try again.") continue except ValueError: print("Invalid input. Please try again.") continue
3 RĂ©ponses
+ 3
Well, it works fine on Sololearn in the playground...
Make sure you don't mix tabs and spaces, often that's the reason
+ 2
ThĂ©ophile thatâs all Iâve done so far.
Matthias ok, Iâll check. Thanks.
By the way, the playground doesnât usually work for me, so I use the python download thing on my laptop. I just post my codes anyway even if they donât run for me.
0
Can you give the link of your code, please? It will be easier for us to help you.