I have this code and I wonder how to make this with using if and whether.
num1 = input("Choose first number: ")
num2 = input("Choose second number: ")
try:
val = int(num1)
except ValueError:
print("The first input is not a number!")
try:
val = int(num2)
except ValueError: print ("The second input is not a number!")
I know that it makes the same but on the level that I am it is better for me to use. If You could I would love it if you could describe how it works. Thank you :)
Aucun commentaire:
Enregistrer un commentaire