Python Basic Level

1. Which keyword is used to define a function in Python?

 
 
 
 

2. Which of the following is a valid Python variable name?

 
 
 
 

3. Which dictionary method returns a value for a key without raising an error if the key is missing?

 
 
 
 

4. Which keyword is used to handle exceptions?

 
 
 
 

5. Which function is used to get input from a user?

 
 
 
 

6. Which statement is used to make a decision in Python?

 
 
 
 

7. Which keyword skips the current loop iteration and moves to the next one?

 
 
 
 

8. Which method adds one item to the end of a list?

 
 
 
 

9. Which string method converts text to lowercase?

 
 
 
 

10. Which data type stores True or False values?

 
 
 
 

11. Which statement imports Python’s math module?

 
 
 
 

12. What is the index of the first character in a Python string?

 
 
 
 

13. Which symbol is used for a single-line comment in Python?

 
 
 
 

14. What does the range(5) function produce when used in a loop?

 
 
 
 

15. Which built-in function returns the number of items in a list?

 
 
 
 

16. How do you create a tuple containing the values 1, 2 and 3?

 
 
 

17. Which data structure stores key-value pairs?

 
 
 
 

18. Which loop is commonly used to iterate over a sequence?

 
 
 
 

19. Which collection is ordered and changeable?

 
 
 
 

20. Which operator is used for exponentiation in Python?

 
 
 
 

21. Which keyword exits a loop immediately?

 
 
 
 

22. What is the purpose of the return statement in a function?

 
 
 
 

23. What is the result of 17 // 5?

 
 
 
 

24. Which block is used to wrap code that may raise an exception?

 
 
 
 

Question 1 of 24

Leave a Reply

Your email address will not be published. Required fields are marked *