+ 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

1st Sep 2019, 12:44 PM
Alice R
Alice R - avatar
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
1st Sep 2019, 1:36 PM
Matthias
Matthias - avatar
+ 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.
1st Sep 2019, 1:38 PM
Alice R
Alice R - avatar
0
Can you give the link of your code, please? It will be easier for us to help you.
1st Sep 2019, 12:47 PM
Théophile
Théophile - avatar