0
0

数値判定 Python3編

Posted at

出力された文字列が数値変換可能かみる

S = input()
if  S.isdecimal() == True:
    print('YES')
else:
    print('NO')

他にもあたえらえたのが全部数値か調べるということで

s = input()

if s.isdigit():
    print("YES")
else:
    print("NO")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0