C validating numeric input Sex random chat freee
Final Code: def input Number(message): while True: try: user Input = int(input(message)) except Value Error: print("Not an integer!Try again.") continue else: return user Input break #MAIN PROGRAM STARTS HERE: age = input Number("How old are you?You can use Regular Expression to validate a Textbox to enter number only.
You should be able to return 0; instead of exit(0).As i understand I need to check each char in the string for validation(no numbers or symbols). I created a function bool(is Letter) and call that for string validation but that appears to be a bit off as well.Any ideas to help push me in the right direction would be much appreciated. Here is my code: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 In your validation function you seem to be returning invalid if any of the characters is not a number or a space, which is not what you want. -- Aymeric GAURAT APELLI Consultant 3IE ( "Dmitry Karneyev" I need such control to bind numeric data from database with Windows Form. Forms; namespace Your App ------------------------ Best regards.
This new function can then be used instead of an input() function whenever we expect the user to enter a whole number.