1
Buggy code: x = 5 print(y) What is the correct fix?
2
Buggy code: a = 10 if a > 5 print('big') What is the correct fix?
3
Buggy code: total = 0 for i in range(5) total += i What is the correct fix?
4
Buggy code: def add(a,b) return a+b What is the correct fix?
5
Buggy code: nums = [1,2,3] print(nums[3]) What is the correct fix?
6
Buggy code: class Counter: def __init__(self): self.value = 0 def increment(): self.value += 1 c = Counter() c.increment() print(c.value) What is the correct fix?
7
Buggy code: x = 1 if x > 0: print('positive') What is the correct fix?
8
Buggy code: squares = [i*i for i in range(5) if i % 2 = 0] What is the correct fix?
9
Buggy code: def fact(n): if n==0: return 1 else: return n * fact(n-1) What is the correct fix?
10