What does the following program print?
m = 0
for n in [1.8, 4.2, 1.6, 2.0, 1.88]:
m += int(n)
print(m)What is the output of the following program?
s = ""
i = 1
for digit in ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]:
if len(digit) < 5 and i % 2 == 1:
s = digit + s
i += 1
print(s)range
functionWhat does each of the following range calls, converted
to a list, evaluate to?
list(range(3))list(range(4, 7))list(range(4, 0, -1))How many elements are in the following ranges?
range(732)
range(6, 88)
range(4, 2)
range(20, 21)
range(0)
What does the following program print?
for x in range(1,4):
print(x + x * x, end=str(x))Consider the following incomplete program:
x =
y =
for z in range(x, y):
print("WWU")What pairs of values could be assigned to the variables
x and y so that the program prints
WWU 43 times? Select all correct choices.
x: 0 y: 44x: -21 y: 22x: -21 y:21x: -789 y: -746x: -789 y: 746x: 1 y: 44Write a program that prompts the user for a positive integer
\(p\) and uses a for loop
to print the powers of 2 up to \(2^p\)
(starting at \(p\) == 0).