指定した数が、正の数か負の数か判定する関数
def discri(a):
if a > 0:
return str(a) + 'は正の数です。'
elif a == 0:
return str(a) + 'はゼロです。'
else:
return str(a) + 'は負の数です。'
print(discri(15))
print(discri(0))
print(discri(-24))
15と0とー24を判定。
Go to list of users who liked
More than 3 years have passed since last update.
指定した数が、正の数か負の数か判定する関数
def discri(a):
if a > 0:
return str(a) + 'は正の数です。'
elif a == 0:
return str(a) + 'はゼロです。'
else:
return str(a) + 'は負の数です。'
print(discri(15))
print(discri(0))
print(discri(-24))
15と0とー24を判定。
Register as a new user and use Qiita more conveniently
Go to list of users who liked