Type the program's output result = 0 n=2 while n > -1: print (n, end='') result -= 3 n -= 1 else: print(f'/(result)') print('done')
Added by Eric B.
Close
Step 1
Initialize the variable "result" to 0. Show more…
Show all steps
Your feedback will help us improve your experience
Hast Aggarwal and 91 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Let $f_{1}(n)=1+\frac{1}{2}+\frac{1}{3}+\ldots+\frac{1}{n}$, then $f_{1}(1)+f_{1}(2)+f_{1}(3)$ $+\ldots+f_{1}(n)$ is equal to (A) $n f_{1}(n)-1$ (B) $(n+1) f_{1}(n)+n$ (C) $(n+1) f_{1}(n)-n$ (D) $n f_{1}(n)+n$
Consider this function given in recursive form. f(1) = -3 f(n) = 3f(n - 1) ; n ≥ 1 Select the equivalent explicit function for n ≥ 1. A. f(n) = -3(n) B. f(n) = -1(3)^n C. f(n) = -3(n - 1) D. f(n) = -1(3)^(n-1)
Antonio F.
Use the Addition Principle. How many times is the print statement executed? $$\begin{aligned}&\begin{array}{c}\text { for } i=1 \text { to } m \\\text { for } j=1 \text { to } n\end{array}\\&\operatorname{println}(i, j)\end{aligned}$$
Counting Methods and the Pigeonhole Principle
Basic Principles
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD