[PYTHON] Function review

A function that determines whether a specified number is a positive number or a negative number

def discri(a):
    if a > 0:
        return str(a) + 'Is a positive number.'
    elif a == 0:
        return str(a) + 'Is zero.'
    else:
        return str(a) + 'Is a negative number.'

print(discri(15))
print(discri(0))
print(discri(-24))

Judge 15 and 0 and -24.

Recommended Posts

Function review
[Python] function
In-function function
Recursive function
In-function function
python function ②
yukicoder contest 259 Review
AtCoderBeginnerContest180 Review & Summary
yukicoder contest 264 Review
python enumerate function
AtCoderBeginnerContest181 Review & Summary
AtCoderBeginnerContest182 Review & Summary
Python> function> Closure
yukicoder contest 261 Review
yukicoder contest 267 Review
[Python] Generator function
Review of exceptions
AtCoderBeginnerContest183 Review & Summary
AtCoderBeginnerContest179 Review & Summary
yukicoder contest 266 Review
Python> function> Inner function
Duality in function
yukicoder contest 263 Review
Python function decorator
the shell review
yukicoder contest 268 Review