Print a countdown from n to 1 The function below takes one parameter: an integer (begin). Complete the function so that it prints the numbers starting at begin down to 1, each on a separate line. There are two recommended approaches for this:

(1) use a for loop over a range statement with a negative step value, or

(2) use a while loop, printing and decrementing the value each time.

student.py 1 - def print_countdown(begin): # Implement your function here. Be sure to indent your code block! Restore original file

Respuesta :

Answer:

Explanation:

>>> def print_countdown(begin)

>>> i = begin

>>> while i < 1:

>>>  print(i)

>>>  i = i - 1

>>>print_countdown(0)

The program is an illustration of loops.

Loops are used to carry out repetition operations;

The program in Python, where comments are used to explain each line is as follows:

#This defines the function

def print_countdown(begin):

   #This iteration is repeated until 1 is printed

   while begin>=1:

       #This prints the countdown

       print(begin,end=" ")

       #This decreases the number by 1, until it gets to 1

       begin-=1

       

The above program is implemented using a while loop

Read more about similar programs at:

https://brainly.com/question/22555783