Python Test 3 - For and While

What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
i.upper()
print(x)

What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)

What will be the output of the following Python code?

i = 1
while True:
if i%3 == 0:
break
print(i)

i + = 1

What will be the output of the following Python code?

i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1

What will be the output of the following Python code?

i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 1

What will be the output of the following Python code?

i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 1

What will be the output of the following Python code?

i = 1
while True:
if i%2 == 0:
break
print(i)
i += 2

What will be the output of the following Python code?

i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2

What will be the output of the following Python code?

i = 1
while False:
if i%2 == 0:
break
print(i)
i += 2

What will be the output of the following Python code?

True = False
while True:
print(True)
break

Schreibe einen Kommentar