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?
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?
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):. |