import getpass, sys

def question_with_response(prompt):
    print("Question: " + prompt)
    msg = input()
    return msg

questions = 4
correct = 0

print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("You will be asked " + str(questions) + " questions.")
question_with_response("Are you ready to take a test?")

rsp = question_with_response("The purpose of lists and dictionaries are to manage the ____ of a program")
if rsp == "complexity":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")

rsp = question_with_response("Lists are a form of data ______")
if rsp == "abstraction":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")

rsp = question_with_response("Which brackets are used to assign values to a variable to make a list?")
if rsp == "[]":
    print(rsp + " is correct!")
    correct += 2
else:
    print(rsp + " is incorrect!") 

print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))
Hello, deduva running /home/deduva/anaconda3/bin/python
You will be asked 4 questions.
Question: Are you ready to take a test?
Question: The purpose of lists and dictionaries are to manage the ____ of a program
complexity is correct!
Question: Lists are a form of data ______
abstraction is correct!
Question: Which brackets are used to assign values to a variable to make a list?
[] is correct!
deduva you scored 4/4
food1 = "pizza" 
food2 = "hot dog" 
food3 = "sushi"
food4 = "strawberry"
food5 = "sandwich"
food_list = [food1 + food2 + food3 + food4 + food5]
print(food_list)

Above is the food list I simplified, and below is a new list that I made that retrieves the third index and displays it.

food1 = "Pizza"
food2 = "Icecream"
food3 = "Coffee"
food4 = "Mangos"
food5 = "Strawberries"
food_list = [food1, food2, food3, food4, food5]
print(food_list[3])

Below are all the questions and answers.

  • In your own words, briefly explain by writing down what an assignment operator is

  • In Collegeboard pseudocode, what symbol is used to assign values to variables?

  • A variable, x, is initially given a value of 15. Later on, the value for x is changed to 22. If you print x, would the command display 15 or 22?

  1. An assignment operator is a symbol used to assign a value to a variable. For example = in python.

  2. An arrow to the left pointing from the value towards the variable it should be assigned to.

  3. The command would display 22, because variables are always the most recently assigned value.

  • There's more than one way to define the variable. List two ways to do it.
  1. You can define a variable using a number. For example: x = 5.

  2. You can also assign a prexisting variable to a new one. For example: x = 5, then y = x.

  • What is a list?

  • What is an element

  • What is an easy way to reference the elements in a list or string?

  • What is an example of a string?

  1. A list is a sequence of elements with each element being a variable.

  2. An element is a part of a list, and can be accessed using indexes.

  3. An easy way to reference the elements in a list or string is using indexes, which select an element in respect to their order in the list or string.

  4. An example of a string is "You can put literally anything inside of quotation marks."