a = 5
b = 4
print(x * y)
2. What does the following code snippet do?
def factorial_num(n):
if n == 0:
return 1
else:
return n * factorial_num(n-1)
num = 10
print(factorial_num(num))
3. What will be the output of the following code snippet?
a = 5
b = 4
a, b = b, a
print(a, b)
4. What will be the output of the following code snippet?
num_list = [2, 3, 4, 5, 6, 7, 8, 2]
unique_nums = []
for num in num_list:
if num not in unique_nums:
unique_nums.append(num)
print(unique_nums)
5. What will be the output of the following code snippet?
a = 5
print(a ** 3)
6. What is the output of the following code snippet?
tuple1 = (1, 2, 3)
a, b, c = tuple1
print(b)
7. What will be the output of the following code snippet?
num_list = [1, 2, 3]
num_list.append(4)
print(num_list)
8. What is the output of the following code snippet?
num_set = {1, 2, 3, 4, 5}
num_set.add(6)
print(len(num_set))
9. What is the output of the following code snippet?
num_set = {1, 3, 3, 4, 5}
num_set.discard(3)
print(len(num_set))