Podcast
Questions and Answers
x = 10
y = 20
if x > 5 and y < 25:
x += 5
y += 5
elif x > 5 or y > 25:
x -= 5
y -= 5
else:
x *= 2
y *= 2
x = 10
y = 20
if x > 5 and y < 25:
x += 5
y += 5
elif x > 5 or y > 25:
x -= 5
y -= 5
else:
x *= 2
y *= 2
- x = 10, y = 20
- x = 5, y = 15
- x = 15, y = 25 (correct)
- x = 20, y = 40
if data['info']['status'] == 'active' and data['info']['count'] > 30:
result = "Proceed"
else:
result = "Hold"
if data['info']['status'] == 'active' and data['info']['count'] > 30:
result = "Proceed"
else:
result = "Hold"
- Proceed (correct)
- Hold
- Error
- None
s = "Hello World"
if s[:5] == "Hello":
print("Greeting detected!")
else:
print("No greeting.")
s = "Hello World"
if s[:5] == "Hello":
print("Greeting detected!")
else:
print("No greeting.")
- Hello World
- Greeting detected! (correct)
- No greeting.
- Error
numbers = [1, 2, 3, 4, 5]
sum = 0
for n in numbers:
if n % 2 == 0:
sum += n
print(sum)
numbers = [1, 2, 3, 4, 5]
sum = 0
for n in numbers:
if n % 2 == 0:
sum += n
print(sum)