search

Home  >  Q&A  >  body text

Determine whether the input is a number

def is_number(s): try: float(s) return True except ValueError: pass pass try: import unicodedata unicodedata.numeric(s) except(TypeError,ValueError): pass pass return Falsewhile False: ten=input('Enter numbers ') is_number(ten) print ('The input is not a number')print('The input is a number')

P粉325107286P粉325107286951 days ago1097

reply all(0)I'll reply

No reply
  • Cancelreply