Popcorn Hack 1: Defining a variable

favoriteGame = "Phasmaphobia";
print(favoriteGame);
Phasmaphobia

Popcorn Hack 2: Defining different data types as variables

valorantMain = "Raze"
kills = 12
yesWin = True

print(valorantMain + " is a string.");
print(str(kills) + " is intiger.");
print(str(yesWin) + " is boolean")

print("My valorant main is " + valorantMain + " and I have " + str(kills) + " kills. It is also " + str(yesWin) + " that we won the last game.");
Raze is a string.
12 is intiger.
True is boolean
My valorant main is Raze and I have 12 kills. It is also True that we won the last game.

Popcorn Hack 3: Changing the values

currentScore = 10
highScore = currentScore
currentScore = 7
print(str(highScore))
#Example
10
money = 100
afterBuy = money
afterBuy = 80
print(str(afterBuy))
80

**Each element string is referenced by an index. Most code have an index that starts at 0, but College Board starts at 1.

Popcorn Hack 4: Lists

classSchedule = ["AP Calc BC", "AP Physics", "AP English Language", "AP Computer Science", "Offrole"];
print("My second period is " + classSchedule[1]);
My second period is AP Physics

Popcorn Hack 5: Replacing list values

mains = ["Sage", "Gekko", "Omen"];
newMains = ["Kay-o", "Neon", "Jett", "Raze"];

mains = newMains

print(newMains)
['Kay-o', 'Neon', 'Jett', 'Raze']

Homework: Hack 1-

# Variable 1

numStudents = 26
print(numStudents)

#Variable 2

car = "Tesla"
print(car)

#Variable 3

groupMates = ["Nikki", "Monika", "Ankit", "Varun"]
print(groupMates)

#Variable 4

dogsbeatcats = True
print(dogsbeatcats)

print("Integer: Variable 1 (" + str(numStudents) +")")
print("List: Variable 3 (" + str(groupMates) + ")")
print("Boolean: Variable 4 (" + str(dogsbeatcats) + ")")
print("String: Variable 2 (" + car + ")")
26
Tesla
['Nikki', 'Monika', 'Ankit', 'Varun']
True
Integer: Variable 1 (26)
List: Variable 3 (['Nikki', 'Monika', 'Ankit', 'Varun'])
Boolean: Variable 4 (True)
String: Variable 2 (Tesla)

Hack 2-

import json

kills = 21
mains = ["Kay-o", "Neon", "Jett", "Raze"]
yesWin = True
currentCharacter = "Raze"

print(type(mains))
vMains = json.dumps(mains)
print(type(vMains))
print("I main: " + vMains)

print(type(kills))
k = json.dumps(kills)
print(type(k))
print("I've defeated " + k + " people.")

print(type(yesWin))
win = json.dumps(yesWin)
print(type(win))
print("It is " + win + " that we won.")
<class 'list'>
<class 'str'>
I main: ["Kay-o", "Neon", "Jett", "Raze"]
<class 'int'>
<class 'str'>
I've defeated 21 people.
<class 'bool'>
<class 'str'>
It is true that we won.