Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Validate User's Input In Python
Hmm, I just want to share a little snippet to validate user's input in python.

#1 - validate an integer, float

input = input("Enter an integer or a float, otherwise I raise a warning flag_ ");

   input = int(input)
except ValueError:
   print "Don't I tell you to enter an integer or a float, do you think I was joking, well you are busted"
    print "Good, you are as obedient as puppet"

I am a proud member of NIgerian Coders Team
Nice one dude!
It takes so long to learn simplicity.

Possibly Related Threads...
Thread Author Replies Views Last Post
  A Simple Guessing Game Written In Python Atibioke 3 497 10-19-2018, 01:27 PM
Last Post: ibraheem
  FUN: Rhombus With Python Mbabalawlar 0 110 01-06-2018, 10:00 PM
Last Post: Mbabalawlar
  FUN: Love Calculator With Python Mbabalawlar 0 136 01-06-2018, 09:56 PM
Last Post: Mbabalawlar
  TUTORIAL: My First Project Quiz In Python Programming Mbabalawlar 0 128 01-06-2018, 09:50 PM
Last Post: Mbabalawlar
  SHARED: Why Learn Python? cheatex 5 500 04-27-2017, 08:54 PM
Last Post: devHammed
  Creating A Simple Random Username And Password Generator With Python Jolliano 4 723 01-01-2017, 10:58 PM
Last Post: Jolliano
  Python Program To Solve Quadratic Equation dealwap 4 699 12-10-2016, 08:43 AM
Last Post: dealwap
  Awesome Python Tricks A Beginner Should Know smartlord 8 761 12-04-2016, 01:48 PM
Last Post: Ahkohd
  Check If A Variable Is Defined Or Not In Python Ahkohd 0 281 12-03-2016, 09:42 AM
Last Post: Ahkohd
  Why You Should Learn Python As Your First Programming Language dealwap 0 382 11-04-2016, 07:37 AM
Last Post: dealwap

Users browsing this thread: 1 Guest(s)

About Nigeria's Creative Talents

Nigeria's Creative Talents is an online community where every creative Nigerians can share ideas with themselves.

For any more information, please use our contact form.

              User Links