0
1

More than 3 years have passed since last update.

関数の復習

Last updated at Posted at 2019-12-30

指定した数が、正の数か負の数か判定する関数

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を判定。

0
1
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
1