Skip to the content.

Variables Team Teach • 4 min read

x="jayden is the best"
print(x)
jayden is the best
highscore = 10
isRaining = False
firstName = "Jayden"
print(str(highscore)+" is an integer")
print(str(isRaining)+" is an boolean")
print(str(firstName)+" is a string")
10 is an integer
False is an boolean
Jayden is a string
currentScore = 10
highScore = currentScore
highScore = 7
print(str(highScore))
7
num1 = 420
num2 = 21
num3 = 69
num2 = num3
num3 = num1
num1 = num2
print(str(num1))
print(str(num2))
print(str(num3))
69
69
420
CoolKids = ["Jayden", "Will", "Howie", "Nihar"]
print("Literally from Ohio:")
print(CoolKids[0])
print(CoolKids[1])
print(CoolKids[2])
print(CoolKids[3])
Literally from Ohio:
Jayden
Will
Howie
Nihar
CoolClasses = ["HMI", "APEL", "AP Calc BC", "APCSP", "US History"]
print("Most Ohio Class:")
print(CoolClasses[2])
print(CoolClasses[2])
print(CoolClasses[2])
print(CoolClasses[2])
Most Ohio Class:
AP Calc BC
AP Calc BC
AP Calc BC
AP Calc BC

Hack 1

Integer: Variable 1 List: Variable 3 Booleon: Variable 4 String: Variable 2

# Variable 1: Integer

numstudents = 26
print(numstudents)

# Variable 2

car = "Tesla"
print(car)

# Variable 3

groupMates = ("Nikki", "Monike", "Ankit", "Varun")
print(groupMates)

# Variable 4

dogsbeatcats = True
print(dogsbeatcats)
26
allen
('100 Grand', 'Swedish Fish', 'Twix', 'Hershey')
True

Hack 2

# Variable 1

Age = 16
print(Age)

# Variable 2

car = "lexus"
print(car)

# Variable 3

favoritecandy = ["100 Grand", "Swedish Fish", "Twix", "Hershey"]

import json
lst = [favoritecandy]
print(type(lst))
favoritecandy = json.dumps(lst)
print(favoritecandy)
print(type(favoritecandy))

# Variable 4

Jaydeniscool = True
print(Jaydeniscool)
16
lexus
<class 'list'>
[["100 Grand", "Swedish Fish", "Twix", "Hershey"]]
<class 'str'>
True