Skip to content

Instantly share code, notes, and snippets.

@saraswatmks
Created August 19, 2022 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saraswatmks/4a5730043a8a3dae6ad9b3d5a97da3f2 to your computer and use it in GitHub Desktop.
Save saraswatmks/4a5730043a8a3dae6ad9b3d5a97da3f2 to your computer and use it in GitHub Desktop.
Validate input response
def validate_input(gross):
try:
return int(gross)
except ValueError as e:
print("Incorrect gross input. Please provide gross value as int or float.")
gross = input('provide gross input')
gross = validate_input(gross)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment