Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use python, please help below questions. Question 1 1 pts Write a function countdown_loop() that prints numbers counting down from a number n to 0
Use python, please help below questions.
Question 1 1 pts Write a function countdown_loop() that prints numbers counting down from a number n to 0 (or 1) without recursion. The first line has been written for you. Use four spaces to indent. def countdown_loop(n): Question 2 1 pts Write a function countdown_recur() that prints numbers counting down from a number n to 0 (or 1) using recursion. The first line has been written for you. Use four spaces to indent. def countdown_recur(n): Question 3 3 pts Write a program that compares the run time of your two countdown functions, counting down from 992. Get a start time, run the same countdown function 10 times, and get an end time. Print out the time difference. A possible output might look like: Run time of loop from 992: 0.0123123123 Run time of recursion from 992: 0.0135135135Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started