Skip to the content.

Homework Hacks on Variables • 1 min read

#Variable 1 
numStudents = 26
print(numStudents)


#Variable2
car = 'tesla'
print(car)
 
#Variable3
groupMates=['Nikki', 'Monika', 'Ankit', 'Varun']

#Variable4
dogsbeatcats=True
print(dogsbeatcats)


#Variable 1 is an integer
#Variable 2 is a string
#Variable 3 is a list
#Variable 4 is a boolean
26
tesla
True
#HACK 2
#Integer Variable
number= 25
print(number)
#String variable
string= 'Hello world'
print(string)
#List variable
myclasses=['Stats', 'US History', 'APES', 'APCSP', 'AmLit']
print(myclasses)
#Boolean Variable
Summerbeatswinter= True
print(Summerbeatswinter)

import json
MyJerseynumbers= ['10','14','4','18']
print(type(MyJerseynumbers))
a = json.dumps(MyJerseynumbers)
print(a)
print(type(a))

25
Hello world
['Stats', 'US History', 'APES', 'APCSP', 'AmLit']
True
<class 'list'>
["10", "14", "4", "18"]
<class 'str'>

<class 'list'>
["10", "14", "4", "18"]
<class 'str'>