subject
Computers and Technology, 28.04.2021 17:50 synite

I need a help for this python assignment below: 1. Copy the countdown function from Section 5.8 of your textbook.

def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)

Write a 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!

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.

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. Write your own unique Python program that has a runtime error. Do not copy the program from your textbook or the Internet. Provide the following.

The code 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.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
If the polar bear were taken out of the food chain what would happen to the seal population the seal population would diminish the seal population would grow dramatically the seal population would stay the same the seal population would decrease slightly
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
Answers: 3
question
Computers and Technology, 25.06.2019 01:30
What controls can be found on the file tab of microsoft word
Answers: 1
question
Computers and Technology, 25.06.2019 02:00
What type of multimedia is a game cd? game cds are examples of multimedia
Answers: 1
You know the right answer?
I need a help for this python assignment below: 1. Copy the countdown function from Section 5.8 of...
Questions
Questions on the website: 13722363