Assignment Detail

Tutors

Make a python program that gets a number using keyboard

    Answered

    Assignment Instructions

    1. Copy the countdown function

    def countdown(n):

    if n <=

    0:
    print(‘Blastoff!’)

    else:

    print(n)

    countdown(n-1)

    You need to new recursive function countup that expects a negative argument and counts “up” from that number. Output from running the function should look something like this:

    >>> countup(-3)

    -3

    -2

    -1

    Blastoff!

    You need to make 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 for input of zero.

    Provide the following.

    The code of your program.

    Output for the following input: a positive number, a negative number, and zero.

    An explanation of your choice for what to call for input of zero.

    Need fresh solution to this Assignment without plagiarism?? Get Quote Now

    Expert Answer

    Asked by: Anonymous
    Plagiarism Checked
    Answer Rating:
    4.6/5

    Plagiarism free Answer files are strictly restricted for download to the student who originally posted this question.

    Related Assignments

    //
    Our customer support team is here to answer your questions. You can send Assignments directly to support team.
    👋 Hi, how can I help?