python verifikasi jika string adalah bilangan bulat
'3'.isdigit()
True
'276'.isdigit()
True
'Bob276'.isdigit()
False
# The definition below interger will be flaged "True" as well as float.
def isfloat(num):
try:
float(num)
return True
except ValueError:
return False
print(isfloat('s12'))
False
print(isfloat('1.123'))
True
print(isfloat('456'))
True
Intempestive Al Dente