numStudents = 92
print(numStudents)

car = "Koenigsegg"
print(car)
92
Koenigsegg
highScore = 123
isSunny = False
firstName = "Justin"
print(str(highScore) + " is an integer")
print(str(isSunny) + " is an boolean")
print((firstName) + " is a string")
123 is an integer
False is an boolean
Justin is a string

str above needed because need to define as string for the thing to print

currentScore = 10
highScore = currentScore
currentScore = 7
print(str(highScore))
10
num1 = 25
num2 = 15
num3 = 30
num2 = num3
num3 = num1
num1 = num2
print(str(num1))
print(str(num2))
print(str(num3))
30
30
25
groupClasses = ("Expos", "AFA", "Spanish", "CPS")
print(groupClasses[0])
print(groupClasses[3])
Expos
CPS

letter numbers and special numbers in strings

lists hold elements, variables -spotify songs in a playlists people on a list of attendance

scores1 = [89, 72, 34, 56, 83]
scores2 = [23, 25,96, 55]
scores1 = scores2
print(str(scores1))
[23, 25, 96, 55]
scores1 = 23
scores2 = 35
scores3 = 25
scores4 = 44

scores = (23, 35, 25, 44)
print(str(scores))
(23, 35, 25, 44)

lists can manage data better and change change certain scores better

import json
lst = [1,2,3,4]

Hack 1 Sort the variables in the code cell below into these categories and write the adjoining numbers for each type: Integer: List: Boolean: String:

# Integer
myMoney = 0
print(str(myMoney))

# List
groupMinecraftYoutubers = ("Stampylongnose", "DanTDM", "PopularMMO", "TBNRfrags")
print(groupMinecraftYoutubers)

#Boolean
isTheMoonCheese = False
print(str(isTheMoonCheese))

#String
bestDriverF1 = "Max Verstappen"
print((bestDriverF1))
0
('Stampylongnose', 'DanTDM', 'PopularMMO', 'TBNRfrags')
False
Max Verstappen

Hack 2 Define the variables from above

# Integer
myMoney = 0
print(str(myMoney) + " is an integer on how much money I have")

# List
groupMinecraftYoutubers = ("Stampylongnose", "DanTDM", "PopularMMO", "TBNRfrags")
print(str(groupMinecraftYoutubers) + " is a list of minecraft youtubers")

#Boolean
isTheMoonCheese = False
print(str(isTheMoonCheese) + " is an boolean stating information about the moon")

#String
bestDriverF1 = "Max Verstappen"
print((bestDriverF1) + " is a string with the name of the current best F1 driver")
0 is an integer on how much money I have
('Stampylongnose', 'DanTDM', 'PopularMMO', 'TBNRfrags') is a list of minecraft youtubers
False is an boolean stating information about the moon
Max Verstappen is a string with the name of the current best F1 driver

Reflection

  • Variables is all about classes and variables and then printing a answer from a part of the code.