Which of the following loops prints “Welcome to Python” 10 times?
A

Loading

Practice for loop Questions – Which of the following loops prints “Welcome to Python” 10 times?
A:
for count in range(110):
    print(“Welcome to Python”)
B:
for count in range(010):
    print(“Welcome to Python”)
C:
for count in range(111):
  print(“Welcome to Python”)
D:
for count in range(112):
  print(“Welcome to Python”)

Which of the following loops correctly computes 1/2 + 2/3 + 3/4 + …

Loading

Practice for loop Questions – Which of the following loops correctly computes 1/2 + 2/3 + 3/4 + … + 99/100?
A:
sum = 0
for i in range(199):
    sum += i / (i + 1)
print(“Sum is”, sum)
B:
sum = 0
for i in range(1100):
    sum += i / (i + 1)
print(“Sum is”, sum)
C:
sum = 0
for i in range(1.099.0):
    sum += i / (i + 1)
print(“Sum is”, sum)
D:
sum = 0
for i in range(1.0100.0):
    sum += i / (i + 1)
print(“Sum is”, sum)