Share Your Feedback

Fill in the Blanks: Python Basics

Fill in the Blanks: Python Basics

  1. Python is a ____-level, general-purpose programming language known for its clear syntax and readability.
    Answer: high

  2. Python source code files always use the ____ extension.
    Answer: .py

  3. The ____ function in Python is used to output text or variables to the console.
    Answer: print

  4. The default separator between multiple values in the print function is ____.
    Answer: a space (' ')

  5. To change the ending character of a print statement, use the ____ parameter.
    Answer: end

  6. In Python, the ____ character is used to insert a tab space in the output.
    Answer: \t

  7. A ____ error occurs when the Python interpreter finds code that does not conform to the rules of the Python language.
    Answer: syntax

  8. In Python, comments that start with the ____ symbol are called single-line comments.
    Answer: #

  9. Multi-line comments in Python are enclosed in ____ or ____.
    Answer: triple double quotes ("""), triple single quotes (''')

  10. Python uses ____ to define the scope of code blocks, such as loops and conditional statements.
    Answer: indentation

  11. The with statement in Python automatically ____ a file after the block of code is executed.
    Answer: closes

  12. The ____ module in Python provides functions to interact with the operating system, such as getcwd() to get the current working directory.
    Answer: os

  13. To print a formatted string in Python, you can use ____.
    Answer: f-strings

  14. The ____ parameter in the print function specifies how to separate multiple values.
    Answer: sep

  15. The escape sequence ____ is used to insert a newline character in a string.
    Answer: \n

  16. A ____ error occurs while the program is being executed, such as division by zero or file not found.
    Answer: run-time

  17. The ____ function is used to write output to a file instead of the console.
    Answer: print

  18. In Python, the ____ operator can be used to repeat a string multiple times.
    Answer: *

  19. The ____ function in Python is used to open a file for reading or writing.
    Answer: open

  20. Indentation in Python is typically done using ____ spaces per level.
    Answer: 4