+ 7

Another question!

my code is like this: print(input("Enter your name:")) print(input("Enter account number:")) um_um = input("If you want to deposit an amount, click 0 , if you want to with draw an amount, click 1:") if um_um == "0": print(input("Amount to be deposited:")) elif um_um == "1": print(input("Amount to be deposited:")) else: print("error") On output, it's showing that, else: ^ Syntax error: invalid syntax But why? Can someone please lemme know :(

4th Apr 2021, 1:29 PM
Rosy
Rosy - avatar
5 Respuestas
+ 7
Try to align the `else` block at the same indent level of the `elif` block above it.
4th Apr 2021, 1:32 PM
Ipang
+ 4
Tapabrata banerjee Thanks!
5th Apr 2021, 7:29 AM
Rosy
Rosy - avatar
+ 2
Indentation error!. The else should be on d same indent level with if and elif. Asides dat, the code is correct.
5th Apr 2021, 10:53 AM
Adibeh Esther
Adibeh Esther - avatar