1. Who created Python?
2. What is Python?
3. What is a variable in Python?
4. Which of the following is the correct statement to print "Hello, World!" in Python?
print("Hello, World!").5. Which of the following is a valid variable name in Python?
6. What symbol is used to comment a single line in Python?
7. Find the correct answer for this logical operator ( (4>3) and (5>2) )?
(4 > 3) and (5 > 2) evaluates to True.8. What is the output of the following code: print(2 + 3)?
print(2 + 3) is 5.9. Which operator uses +, -,*, %, /
10. To make nested if loop, which one is used?
11. Which of the following is a correct way to start a conditional statement in Python?
if (x > y):.12. What will be the output of the following code: `if 3 > 2: print("True") else: print("False")`?
if 3 > 2: print("True") else: print("False") will be False.13. Which operator is used to compare two values?
14. How do you create a list in Python?
myList = [1, 2, 3].15. How do you access the first element of a list `myList` in Python?
myList[0].16. What will be the output of `len([1, 2, 3, 4])`?
len([1, 2, 3, 4]) is 4.17. Which method is used to add an element to a set in Python?
add().18. Which of the following collections allows duplicate elements?
List.19. What is the result of `5 % 2`?
5 % 2 is 1.20. Which of the following is used to create a dictionary in Python?
{}.21. What will be the output of the following code?
def mystery_function(n):
if n == 0:
return 0
return n + mystery_function(n-1)
print(mystery_function(4))
22. What does the `enumerate()` function do in Python?
23. What is the purpose of the `zip()` function in Python?
24. How do you remove an item from a list in Python?
25. What is the output of the following code?
my_dict = {"a": 1, "b": 2, "c": 3}
result = sum(my_dict.values())
print(result)
26. How do you check if a key exists in a dictionary?
27. What does the `range()` function in Python do?
28. How do you convert a string to uppercase in Python?
29. What will be the output of the following code?
my_list = [1, 2, 3]
my_list[1] = 4
print(my_list)
30. What does the `split()` method do in Python?