I'm using python with the 'Spyder IDE'
Wrote this code a week ago and when I open the file after a week, the code is giving me an indentation error.
The code is meant to take a six-digit number inputted from the user and put it through a few tests using if/else
and match statements
.
import numpy as np
code = input('Please enter a code to break: ')
code = np.array(list(code),dtype=int)
Sum = sum(code[:3])
Sum2 = sum(code[-3:])
# Rule 1, checks whether the user inputted code is six digits long.
#
if len(code) != 6: #<-- Line 35
print("Decoy Message: Not a six-digit number")
# Rule 2, performs requested equation and tests whether its even or odd.
#
else :
if (Sum-Sum2) % 2 != 0:
print("Decoy Message: Sum is odd")
The code doesn't ask for input from the user in the console window, but instead immediately gives an indentation error:
IndentationError: expected an indented block after 'if' statement on line 35
Does anyone know what might be the cause? I haven't downloaded anything new since I wrote the code only a week ago.