id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Athenian: Conditionalsconditionals8

prev  |  next  |  chance

This is a code that determines whether a number is positive, negative, or just 0
by Merrick '23

def positive_negative(x):
    if x > 0:
        return "pos"
    elif x == 0:
        return "0"
    else:
        return "neg"
Function Call  Return Value
positive_negative(5)
positive_negative(-1)
positive_negative(0)
positive_negative(21)
positive_negative(-100)

Experiment with this code on Gitpod.io

⬅ Back