-5

[I edited the question since it has been closed.]

2 Answers2

0

To do so you can use int(age). You may want to implement a try/catch so that the program doesn't throw an exception when the input is invalid.

D4v1d 247
  • 1
  • 2
  • 3
  • 1
    It's not a crash, it's an exception that is thrown, with traceback telling your what went wrong, and then the "program" is terminated. A crash (e.g a segmentation fault) would end the script without any details. – Countour-Integral Jan 12 '21 at 13:51
0

Hey in Python input() is by default store string type value. So you have to put

age=int(input('How old are you: '))

Here int() will store integer type value.

OR

you can also do int(age)

Ujjwal Dash
  • 602
  • 1
  • 2
  • 8