1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
maks197457 [2]
2 years ago
8

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.
Computers and Technology
1 answer:
Lapatulllka [165]2 years ago
4 0

Answer:

def countdown(n):

   if n <= 0:

       print('Blastoff!')

   else:

       print(n)

       countdown(n-1)

       

def countup(n):

   if n >= 0:

       print('Blastoff!')

   else:

       print(n)

       countup(n+1)

number = int(input("Enter a number: "))

if number >= 0:

   countdown(number)

elif number < 0:

   countup(number)

<u>Outputs:</u>

Enter a number: 3                                                                                                              

3                                                                                                                              

2                                                                                                                              

1                                                                                                                              

Blastoff!

Enter a number: -3                                                                                                              

-3                                                                                                                              

-2                                                                                                                              

-1                                                                                                                              

Blastoff!

Enter a number: 0

Blastoff!

For the input of zero, the countdown function is called.

Explanation:

Copy the countdown function

Create a function called countup that takes one parameter, n. The function counts up from n to 0. It will print the numbers from n to -1 and when it reaches 0, it will print "Blastoff!".

Ask the user to enter a number

Check if the number is greater than or equal to 0. If it is, call the countdown function. Otherwise, call the countup function.

You might be interested in
A colleague is complaining about the slowness of a desktop computer, and you explain that the slowness is
mr_godi [17]

Answer:

You are explaining a virtual server

I hope this is correct.

Explanation:

A virtual platform is a software based system that can fully mirror the functionality of the platform, it provides full visibility

A virtual server, on the other hand converts one physical server into multiple virtual machines that can each run their own operating system, it is hosted by a offsite dsta center

6 0
2 years ago
You work for a retail clothing chain whose primary outlets are in shopping malls and are conducting an analysis of your customer
Alla [95]

Answer: Identifying sequences

Explanation:

Since the user wants to know if there are any particular activities that the customers engage in, or the types of purchases made in the month before or after purchasing select items from your store, therefore, the data mining software can be used in identifying sequences.

In this case, the data mining software can't be used in classifying data whether into structured or unstructured data. Furthermore, the identification of clusters and associations aren't the correct answers.

Therefore, the best option is B.

5 0
3 years ago
Creating an application for an ice cream shop. Create an interface named Flavor. Create three subclasses Lemon, Mint, and Chocol
Tpy6a [65]

Answer:

I don't know for sure what the answer is but I hope you can find someone that can give you the answer sorry!

Explanation:

6 0
2 years ago
____________________ multiplexes or separates the data to be transmitted into smaller chunks and then transmitted the chunks on
Alina [70]

Answer:

no one knows

Explanation:

4 0
3 years ago
Jim is categorized as poor. Thus Jim’s daily income must be less than how much dollars?
Cerrena [4.2K]
Under 20 thousand USD.
4 0
3 years ago
Other questions:
  • Which is the most likely reason why scientists change a model?
    12·2 answers
  • When was microsoft word for windows invented?
    13·1 answer
  • Differences between windows xp and windows vista
    14·1 answer
  • What is the boundary folding method?
    5·1 answer
  • Enter a formula using a database function to calculate the total value in the Cost column for expenses that meet the criteria in
    12·1 answer
  • In a Microsoft® Word® document, if a user wanted to organize information in rows in columns, they should select a
    5·1 answer
  • Rule- based systems are subset of expert systems true or false?
    7·1 answer
  • How is a microkernel architecture different from a monolithic architecture?
    5·1 answer
  • Select the correct answer.
    13·1 answer
  • Is it okay for potential employers to search your social media for use in determining if you are a fit for the position?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!