Question: 1.Copy thecountdownfunction from Section 5.8 of your textbook. def countdown(n): if n >> countup(-3) -3 -2 -1 Blastoff! A Python program that gets a number

1.Copy thecountdownfunction from Section 5.8 of your textbook.

def countdown(n):

if n <= 0:

print('Blastoff!')

else:

print(n)

countdown(n-1)

Make a new recursive functioncountupthat 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!

A Python program that gets a number usingkeyboard input. (Remember to useinputfor Python 3 butraw_inputfor Python 2.)

If the number is positive, the program should callcountdown. If the number is negative, the program should callcountup. Choose for yourself which function to call (countdownorcountup) 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.

2. create own unique Python program that has aruntime error. Do not copy the program from your textbook or the Internet. Provide the following.

  • Thecode of your program.
  • Output demonstrating the runtime error, including the error message.
  • An explanation of the error message.
  • An explanation of how to fix the error.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!