Python Forum
How to reject "invalid" input in Python3.7
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to reject "invalid" input in Python3.7
#5
(Feb-08-2019, 12:52 PM)FranSPG Wrote: What do you mean with invalid input ? You can validate the type of the input, like we do in the first script, we validated that the type of input must be a float, or you can validate that the input is the string yes or no.

If you want to validate the type of the input, like we've done in the first script, you need to put your input in a try and except estatement, and force the input to be a string.

Think about how to solve it, and if you can't I'll help you with the code.

Thank you Fran I realized I made another indent error when I was implementing the "except" line, thanks for not spoon feeding me and actually making me think of what went wrong. Really appreciated :)
Reply


Messages In This Thread
RE: How to reject "invalid" input in Python3.7 - by Bruizeh - Feb-09-2019, 12:21 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020