Answer to Question #293004 in Python for Shayan

Question #293004

Write a user-define function, called checkNumber(x), that takes as an input an integer

number (read in the main function using input) and prints out positive, negative, or

zero according to whether the number is positive, negative, or zero.


1
Expert's answer
2022-02-02T05:09:33-0500
def check_number(number):
    if number > 0:
        return 'Positive'
    elif number == 0:
        return 'Zero'
    elif number < 0:
        return 'Negative'


def main():
    number = int(input('Number: '))
    print(check_number(number))


if __name__ == '__main__':
    main()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS