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]
3 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]3 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
What are some positive impacts technology has on the environment?​
dsp73

Answer:

<u>technology</u> has enabled us to capture useful heat through devices such as solar panels

Explanation:

<h3 />
7 0
3 years ago
Read 2 more answers
Why should you delete files from your computer
notka56 [123]

deleting files can free up space and prevent hackers from accessing your sensitive files

5 0
2 years ago
Read 2 more answers
Danelle wants to use a stylus on her laptop but does not have a touch screen. She needs the stylus to help her create designs fo
yarga [219]

Answer:

Correct option is

A. She can add a digitizer over the screen on her laptop

Explanation:

A digitizer is a hardware that receives analogue signal and converts is to digital signal.To use stylus on a normal laptop when can attach a digitizer to the laptop.These digitizer comes in form of Tablet (Graphics Tablet)

Graphics tablet is an external tablet like slate with a dedicated stylus for hand drawn designing and arts. Use of stylus gives more command over design features.It can read any kind of hand written data and transfer to PC.

5 0
3 years ago
What are the advantages of customer relationship managment​
Delvig [45]

Answer:

Enhances Better Customer Service.

Facilitates discovery of new customers.

Increases customer revenues.

Helps the sales team in closing deals faster.

Enhances effective cross and up-selling of products.

Simplifies the sales and marketing processes.

Makes call centers more efficient.

Enhances customer loyalty.

3 0
3 years ago
How is all data stored on a computer?
Maru [420]

Answer:

All data in a computer is stored as a number. Binary data is primarily stored on the hard disk drive (HDD). The device is made up of a spinning disk (or disks) with magnetic coatings and heads that can both read and write information in the form of magnetic patterns.

Explanation:

Please mark me as brainilest if you don't mind and have a wonderful day!! :D

4 0
3 years ago
Read 2 more answers
Other questions:
  • g The reciprocal Fibonacci constant ψ is defined by the infinite sum: ψ=∑n=1 [infinity] 1 Fn Where Fn are the Fibonacci numbers
    7·1 answer
  • Which of the following is the part of a digital camera that acts as the film?
    11·1 answer
  • As the demand for goods and services decreases, job growth.
    14·2 answers
  • Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass? a. class dClas
    12·1 answer
  • Do most web queries have fully meets results
    11·1 answer
  • Write a method that determines the total number of chars in each string of an array.
    12·1 answer
  • How does design influence the product's function?
    5·1 answer
  • Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. T
    7·1 answer
  • ITING THE ANSWER
    9·1 answer
  • Submit a report outlining the steps you will take to obtain digital evidence. In your report you must include the legal requirem
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!