Hack 1

  • An assignment operator is the transition character of a variable. = for python for example
  • Collegeboard pseudocode uses an arrow <--- to assign values to variables
  • If a variable, x, is initially given a value of 15 and ;ater on changed to 22 it would display 22 because it was changed from 15.

Hack 2

  • A list is a series of varaibles that are listed then printed in one
  • An element is the characters isside a string
  • An easy way to reference elementing in a list or string is to use a print command but also list the number of that varable in the list. If it is the thrid item in the list you can put 2 or negative to if theres four items in the list
  • An example of a string is name = "Finn"
name = "Finn"
favfood = ["burger", "steak", "burrito"]
print(name, favfood)
Finn ['burger', 'steak', 'burrito']
food = ["burger", "steak", "burrito"]
print(food[2])
print(food[-1])
burrito
burrito
num1=input("Input a number. ")
num2=input("Input a number. ")
num3=input("Input a number. ")
add=input("How much would you like to add? ")

# Add code in the space below

numlist = [int(num1), int(num2), int(num3)]

# The following is the code that adds the inputted addend to the other numbers. It is hidden from the user.

for i in numlist:
    numlist[i -1] += int(add)

print(numlist)
[5, 6, 7]

Hack 4

Python Quiz

  • Complexity
  • Abstraction
food = ["pizza", "hot dog", "sushi", "strawberry", "sandwich"]
print(food)
  • Lists are better for a program than writing out the code because it makes the code more simple. It allows other programers to understand the code better and make edits easier.
team1 = "Bengals"
team2 = "Saints"
team3 = "Texans"
team4 = "Cowboys"
print(team1, team2, team3, team4)
Bengals Saints Texans Cowboys
team = ["Bengals", "Saint", "Texans", "Cowboys"]
print(team)
['Bengals', 'Saint', 'Texans', 'Cowboys']