Software Dev Python Test Revision
Software Dev Python Test Revision
x=3
y=4
print(x * y)
a) 7
b) 12
c) 34
d) 43
for i in range(4):
print(i + 1)
a) 1 2 3 4
b) 0 1 2 3
c) 1 2 3
d) 2 3 4
x = 20
if x == 10:
print("Ten")
else:
print("Other")
a) Ten
b) Greater than Fifteen
c) Other
d) None
myList.append("d")
print(myList)
def greet(name):
print(greet("Alice"))
a) Alice
b) Hello Alice
c) Hello
d) Error
2. Explain the difference between a while loop and a for loop. Provide
an example of each.
num = 9
if num % 3 == 0:
print("Divisible by 3")
else:
myString = "Python"
print(char)