I am sure this has been covered as I have found several similar topics but they are just not making sense to me. I have been working on this for nearly 3 hours with no progress. I am trying to ask for a user input, and then print their input just as a way for me to check my code, and then I want to check if 0 was entered. If 0 was entered, I want it to be invalid. If anything else, I want it to be valid. Heres my code
#checking for variable to be a 0
def zero_chk(x):
if x == 0:
print ('Value cannot be 0')
else:
print ('valid input')
prompt = 'What is your first number?\n'
num1 = input(prompt)
print(num1) #Input Check. Remove after debug
zero_chk(num1)
If I input a 0, it comes back as a valid input. I cannot understand why it will not return as invalid. Please help, my brain is just about fried on this one. I'm sure it's something very simple but for the life of me I just cant figure it out.