mercredi 2 novembre 2016

Python3 except ValueError: if/else

I want to make a try/except to ensure that the inputted value is a float variable. However i want to make an exception if the inputted value is 'g' then i want to redefine the variable to '9.8' instead of telling me that it must be a number. Below is my try but there seems to be a problem with it. PS ignore my mistake of printing "must be an integer"

enter image description here

Aucun commentaire:

Enregistrer un commentaire