174k views
3 votes
Write a Python program that gets a number using keyboard input. (Remember to use input for Python 3 but raw_input for Python 2.) If the number is positive, the program should call countdown. If the number is negative, the program should call countup. Choose for yourself which function to call (countdown or countup) for input of zero.

1 Answer

4 votes

Answer:

def countup():

pass

def countdown():

pass

x = int(input("Choose a number: "))

if x >= 0:

countup()

if x < 0:

countdown()

Step-by-step explanation:

I start by getting a user input which is saved to variable called "x." I then make if statements to see whether is greater than, equal to, or less than 0. After that, I call the functions.

User Jnanaranjan
by
3.9k points