Question: 1. Consider the following code: start = int(input(Enter the starting number: )) stop = int(input(Enter the ending number: )) x = -5 sum = 0

1. Consider the following code:

start = int(input("Enter the starting number: ")) stop = int(input("Enter the ending number: ")) x = -5 sum = 0 for i in range (start, stop, x): sum = sum + i print (sum) 

What is output if the user enters 18 then 13?

a) 18
b) 0
c) 33
d) 31

2. Consider the following code:

start = int(input("Enter the starting number: ")) stop = int(input("Enter the ending number: ")) x = 6 for i in range (start, stop, x): print (i, end=" ")

What is output if the user enters 12 then 36?

a) 12 18 24 30
b) 18 24 30
c) 18 24 30 36
d) 12 18 24 30 26

3. What is output by the following code?

for x in range (8, 16): print (x * 2, end=" ")
a) 16 18 20 22 24 26 28 32
b) 14 16 18 20 22 24 26 28 30
c) 14 16 18 20 22 24 26 28 32
d) 16 18 20 22 24 26 28 30

4. Consider the following code:

for x (7, 10): print (x)

What is wrong with the program?

a) This program is perfectly fine.
b) The range function should have three parameters.
c) The first line should be for x = range(7, 10):.
d) The first line should be for x in range(7, 10):.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!