- (10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
# Pass by Value
def append(s):
for i in range( len(s) ):
s[i] = s[i] * 2
s = s + [4]
print(s)
def main():
aList = [1, 2, 3]
append(aList)
print(aList)
main()
- (10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
# Multi-Way Decision
a = 5
if a > 0 :
print("a > 0")
elif a < 10 :
print("a < 10")
- (10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
# Simple Decision
a = 5
if a > 0 :
print("a > 0")
if a < 10 :
print("a < 10")