I'm trying to build a vaccine tracker for my apartment complex. When I'm trying to test the below code in jupyter-notebook I receive following error when I use non integer inputs.
Ask: What's the best solution to resolve this error? I'm a complete beginner in python and trying to learn and practice at the same time.
Error:
ValueError Traceback (most recent call last) in 2 print("2.Covaxin") 3 ----> 4 vaccine_type = int(input("Select a number - ")) 5 if vaccine_type ==1: 6 covishieldData
ValueError: invalid literal for int() with base 10: 'a'
Code:
print("1.Covishield")
print("2.Covaxin")
vaccine_type = int(input("Select a number - "))
if vaccine_type ==1:
covishieldData
elif vaccine_type ==2:
covaxinData
else:
print("Invalid Input - Please enter either 1 or 2 to proceed further")