Question
PLZ ANSWER ASAP Question 11 Consider the following code: for x in range (10 28): print(x) What is wrong with this program? a. The range
PLZ ANSWER ASAP
Question 11
Consider the following code:
for x in range (10 28): print(x)
What is wrong with this program?
a. The range function should have three parameters.
b. The first line should be for x in range(10, 28) = x:
c. The first line should be for x in range(10, 28):
d. The loop is missing x = 0
Question 12
Consider the following code:
for i in range (x, y): print (i, end=" ")
What values for x and y will output the code below?
10 11 12 13 14 15 16 17 18 19
a. x = 19 y = 9
b. x = 10 y = 19
c. x = 10 y = 20
d. x = 19 y = 10
Question 13
What is the output by the following code?
for x in range (3): for y in range (4): print("*", end=" ") print("")
Group of answer choices
a. * * * * * * * * * * * *
b. * * * * * * * * * * * *
c. * * * * * * * * * * * * * * * *
d. * * * * * * * * *
Question 16
Consider the following code:
start = int(input("Enter the starting number: ")) stop = int(input("Enter the ending number: ")) x = 3 sum = 0 for i in range (start, stop, x): sum = sum + i print (sum)
What is output if the user enters 10 then 15?
a. 10
b. 15
c. 23
d. 39
Question 17
Consider the following code:
start = int(input("Enter the starting number: ")) stop = int(input("Enter the ending number: ")) x = 4 for i in range (start, stop, x): print (i, end=" ")
What is output if the user enters 20 then 32?
a. 20 24 28 32
b. 20 24 28
c. 24 28 32
d. 24 28
Question 18
What is the output by the following code:
for x in range (1, 10, 2): print (x + 2, end=" ")
What is the output?
a. 3 5 7 9 11
b. 3 5 7 9 11 13 15 17 19
c. 3 4 5 6 7 8 9 10 11
d. 11 9 7 5 3
Question 19
Consider the following code that is meant to print out 7,8,9:
for x in (7, 10): print (x)
What is wrong with the program?
a. The first line should be for x = range(7, 10):
b. The first line should be for x in range(7, 10):
c. The first line should be for x in 7 to 10:
d. This program does not have errors.
Question 20
When do you use a while loop INSTEAD of a for loop? (Choose the best two answers.)
a. To get input from the user until they input stop.
b. To do number calculations.
c. To repeat code.
d. When there is an unknown number of iterations needed.
PLZ ANSWER
Step 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