1. Home
  2. Explore
  3. Computer Science
  4. Python Programming Basics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Python Programming Basics

  • 35Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Python Basics
To check the installed Python version, you type
in the command prompt.

35 questions

  1. 1
    To check the installed Python version, you type
    _____
    in the command prompt.
    Hint

    You need to use the word 'python' followed by a double dash and the word 'version'.

    Answer

    python --version

  2. 2
    The file extension for Python source code files is
    _____
    .
    Hint

    Think about the common abbreviation for Python.

    Answer

    .py

  3. 3
    In Python, the function that outputs text to the screen is called
    _____
    .
    Hint

    Think about what you use to display something.

    Answer

    print

  4. 4
    To exit the Python interactive shell, you can type
    _____
    .
    Hint

    It's a function that closes the session.

    Answer

    exit()

  5. 5
    An IDE is an integrated development environment, and a popular free one for Python is
    _____
    .
    Hint

    It's made by Microsoft and is very popular for coding.

    Answer

    Visual Studio Code

  6. 6
    The operator for floor division in Python is
    _____
    .
    Hint

    It's two forward slashes, used to get integer division without remainder.

    Answer

    //

  7. 7
    The operator that returns the remainder of division is
    _____
    .
    Hint

    It's also called the modulus operator.

    Answer

    %

  8. 8
    The operator for exponentiation in Python is
    _____
    .
    Hint

    It's two asterisks, used to raise a number to a power.

    Answer

    **

  9. 9
    Python follows the acronym
    _____
    for order of operations.
    Hint

    It stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction.

    Answer

    PEMDAS

  10. 10
    Strings in Python can be enclosed in either double or
    _____
    quotes.
    Hint

    It's the other common quote type besides double.

    Answer

    single

  11. 11
    To include a single quote inside a single-quoted string, you should enclose the string in
    _____
    quotes instead.
    Hint

    Use the opposite type of quotes to avoid syntax errors.

    Answer

    double

  12. 12
    In Python, comments start with the
    _____
    symbol.
    Hint

    It's also called the hash or pound symbol.

    Answer

  13. 13
    Variable names in Python can contain letters, numbers, and
    _____
    , but cannot start with a number.
    Hint

    It's a punctuation character that looks like a line.

    Answer

    underscores

  14. 14
    Python variable names are case-
    _____
    , meaning 'Age' and 'age' are different variables.
    Hint

    This means uppercase and lowercase letters are distinguished.

    Answer

    sensitive

  15. 15
    The operator used to assign a value to a variable is
    _____
    .
    Hint

    It's a single equals sign.

    Answer

    =

  16. 16
    Python is
    _____
    typed, meaning you don't have to declare the data type of a variable.
    Hint

    The type is inferred at runtime, not at compile time.

    Answer

    dynamically

  17. 17
    The function used to get user input in Python is
    _____
    .
    Hint

    It's a built-in function that reads a line from the user.

    Answer

    input

  18. 18
    To delete a variable in Python, you use the
    _____
    keyword.
    Hint

    It's short for 'delete'.

    Answer

    del

  19. 19
    The comparison operator for 'equal to' in Python is
    _____
    .
    Hint

    It's two equals signs, not one.

    Answer

    ==

  20. 20
    In an if statement, the condition is followed by a
    _____
    to indicate the start of the code block.
    Hint

    It's a punctuation mark used in many Python structures.

    Answer

    colon

  21. 21
    The keyword
    _____
    is used to add an alternative condition after an if statement.
    Hint

    It's a combination of 'else' and 'if'.

    Answer

    elif

  22. 22
    The keyword
    _____
    provides a fallback block when no previous condition is true.
    Hint

    It's the last option in a conditional chain.

    Answer

    else

  23. 23
    Functions are defined using the
    _____
    keyword.
    Hint

    It's short for 'define'.

    Answer

    def

  24. 24
    Values passed into a function when calling it are called
    _____
    .
    Hint

    Also known as 'parameters'.

    Answer

    arguments

  25. 25
    To send a value back from a function, you use the
    _____
    statement.
    Hint

    It exits the function and optionally passes a value back to the caller.

    Answer

    return

  26. 26
    A function must be
    _____
    before it can be called in your code.
    Hint

    The definition must appear earlier in the file than the call.

    Answer

    defined

  27. 27
    A while loop continues executing as long as its
    _____
    is true.
    Hint

    It's a boolean expression evaluated each iteration.

    Answer

    condition

  28. 28
    To prevent an infinite loop, the variable in the condition should be
    _____
    inside the loop.
    Hint

    You need to change its value so the condition eventually becomes false.

    Answer

    incremented

  29. 29
    The for loop is often used with the
    _____
    function to generate a sequence of numbers.
    Hint

    It creates a range object that generates numbers.

    Answer

    range

  30. 30
    The
    _____
    statement immediately exits a loop.
    Hint

    It 'breaks' out of the loop entirely.

    Answer

    break

  31. 31
    The
    _____
    statement skips the rest of the current iteration and moves to the next one.
    Hint

    It 'continues' with the next cycle of the loop.

    Answer

    continue

  32. 32
    To use the math library, you write
    _____
    math at the top of your script.
    Hint

    It's the keyword to bring in external modules.

    Answer

    import

  33. 33
    A
    _____
    error occurs when code violates the grammatical rules of Python.
    Hint

    It's like a spelling or grammar mistake in code.

    Answer

    syntax

  34. 34
    A
    _____
    error occurs during program execution, like dividing by zero.
    Hint

    It happens 'at runtime' while the program is running.

    Answer

    runtime

  35. 35
    A
    _____
    error means the program runs but produces incorrect results due to flawed logic.
    Hint

    It's related to meaning, not syntax.

    Answer

    semantic

1 of 35
Question 1 of 35

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent