Skip to the content.

Variables • 2 min read

Description

Variables Team Lesson

Popcorn Hack

favoritefood = "burrito"
print(favoritefood)
burrito

Data Types Hack

-Integer: Mathematical Numbers -Booiean: yes/no or true/false statements -String (text): text based info

integer = 9
happy = True
name = "Aidan"
print(str(integer) + " is an integer")
print(str(happy) + " is a boolean")
print(name + " is a string")

9 is an integer
True is a boolean
Aidan is a string

Changing Values Hack

print(str(integer))
9
num1=20
num2=15
num3=10
num2=num3
num3=num1
num1=num2
print(str(num1))
print(str(num2))
print(str(num3))
10
10
20

Strings and Lists Hacks

  • String: ordered sequence of characters
  • Lists: an ordered sequence of elements
classList = ["Apes", "HMI", "Calc AB", "CSP"]
print(classList[1])

Homework Hacks

HW Hack 1

  • Integer - Variable 1
  • List - Variable 3
  • Boolean - Variable 4
  • String - Variable 2

Homework hack 2

# Integer
numSiblings = 3
print(numSiblings)

# List
classList = ["Apes", "HMI", "Calc AB", "CSP"]
print(classList)

# Booiean
iluv2code= True
print(iluv2code)

# String
myfavfood = "Chicken"
print(myfavfood)
3
['Apes', 'HMI', 'Calc AB', 'CSP']
True
Chicken