python

Cards (62)

  • What type of system does Python run on?
    Interpreter system
  • Why is indentation important in Python?
    It defines the structure and flow of the code
  • When is a variable created in Python?
    When you assign a value to it
  • Can a variable in Python change its type after being set?
    Yes, a variable can change type after being set
  • What must a variable name in Python start with?
    A letter or underscore character
  • Are variable names in Python case-sensitive?
    Yes, variable names are case-sensitive
  • What is the purpose of unpacking in Python?
    Extracting values into variables
  • What are global variables in Python?
    Variables created outside of a function
  • How is the length of an array calculated in Python?
    Length = highest array index + 1
  • What is used in Python instead of an array?
    A list
  • What is list comprehension in Python?
    A shorter syntax to create a new list based on an existing list
  • What are iterable objects in Python?
    Objects from which you can get an iterator
  • What are examples of iterable objects in Python?
    • Lists
    • Tuples
    • Dictionaries
    • Sets
    • Strings
  • What is the purpose of the print() function in Python?
    To output variables
  • How can multiple variables be outputted using print()?
    Using a comma or plus sign
  • What does the in() function do in Python?
    It allows input of values into a variable
  • What does str() function return in Python?
    Text type
  • What does int() function represent in Python?
    Numeric type without decimals
  • What does float() function represent in Python?
    Numeric type with one or more decimals
  • How are scientific numbers represented in Python?
    With "e" to indicate the power of 10
  • What does abs() function return in Python?
    Absolute value
  • What does round() function do in Python?
    Rounds a number
  • How is a complex number represented in Python?
    With a "j" as the imaginary part
  • What is the purpose of list[] in Python?
    To store multiple items in a single variable
  • How is a tuple defined in Python?
    Using round brackets ()
  • What is the main characteristic of a tuple?
    It is unchangeable
  • What does range() function do in Python?
    Returns a sequence of numbers
  • What is the purpose of dict{} in Python?
    To store data values in key: value pairs
  • What is a characteristic of a dictionary in Python?
    It is unordered
  • What does set{} represent in Python?
    Used to store multiple items in a single variable
  • What is a characteristic of a set in Python?
    It is unordered
  • What does bool() function return in Python?
    True or false
  • What does the addition operator (+) do in Python?
    Adds two values
  • What does the subtraction operator (-) do in Python?
    Subtracts one value from another
  • What does the multiplication operator (*) do in Python?
    Multiplies two values
  • What does the division operator (/) do in Python?
    Divides one value by another
  • What does the modulo operator (%) do in Python?
    Returns the remainder of a division
  • What does the power operator (**) do in Python?
    Raises a number to the power of another
  • What does the floor division operator (//) do in Python?
    Divides and returns the largest whole number
  • What does the equality operator (==) check in Python?
    Checks if two values are equal