Python Basics For Beginner

Check your understanding of Python basics.

1. Which of the following is a valid variable name in Python?
2. What is the output of: print(5 // 2)?
3. Python uses indentation (spaces/tabs) to define code blocks (e.g., inside loops or conditionals).
4. What keyword is used to define a function in Python?
5. What data type is the value '3.14' in Python?
6. Which of the following are primitive (basic built-in) data types in Python? (Select all that apply)
7. What is the result of 'Py' + 'thon' in Python?
8. A tuple in Python is mutable (can be modified after creation).
9. What symbol is used to write a single-line comment in Python?
10. If my_list = [10, 20, 30, 40], what is the value of my_list[1]?
11. Which loop types are available in Python? (Select all that apply)
12. Which keyword starts an alternative block in an if statement?
13. What is the output of: print('Hello' + ' ' + 'Python')
14. The 'and' logical operator returns True only if both operands are True.
15. Which are valid ways to create a list in Python? (Select all that apply)
16. What is x after: x = 10; x += 5
17. Name the data type that stores key-value pairs (e.g., {'name': 'Alice', 'age': 30}).
18. Which method converts a string to lowercase?
19. Which method adds an element to the end of a list?
20. What does the input() function return by default?
Answered 0 of 0 — 0 correct