How to get output value of Nonetype variable as integer

96 views Asked by At

Please need help. I want to pick an output value from a nonetype variable and subtract it from an integer variable

i wrote down an input box but am not able to pick the value from the assigned variable as integer type

The algorithm image found below. Thank you

unsupported operand type(s) for -: 'int' and 'NoneType'

1

There are 1 answers

0
Kyle Smith On

You cannot "pick out" values from a NoneType. NoneType is None, nothing, null.

You're not storing "user_age", you need to remove print. Print doesn't return anything.

user_age = input("what is your current age")
user_age = int(user_age) # convert string to int

age_limit = 90
age = age_limit - user_age

Also, you should google your error first before submitting a new one. This has already been answered multiple times. Python Error: unsupported operand type(s) for +: 'int' and 'NoneType'