string = "Jason"
print(string)
Jason
num = 123456
string = "number"
bool = False
print(bool)
False
a = 1 #defining the variables
b = 2
c = 3

a = c = b #making a and c equals to b

print(a, b, c) #print
2 2 2
myList =  1, 2, 3, 4, 5 #Creating a list called "myList"

print(myList) #Priting out the list.
(1, 2, 3, 4, 5)
items = {
    "MacBook = 2017  " #Macbook, got it since 2017.
    
    "Clock = 0  " #Cloke, broke.
    
    "Trash = 1234567890" #trash everywhere, unstopable.

}

print(items)


{'MacBook = 2017  Clock = 0  Trash = 1234567890'}

Data Abstraction HW

  • Create a class called Person with the attributes name and age. Then create a function called print_people that takes in a list of people and prints out their names and ages.
  • Create a function that takes in a dictionary of people and their ages and prints out the name of the oldest person.
people = {
    "Jason" : 15,
    "Jim" : 14,
    "Micky" : 47,
    "Beth" : 39
} #this is the dictionary called "people".


for person in people:
    print(person + " is " + str(people[person]) + " years old" )

Jason is 15 years old
Jim is 14 years old
Micky is 47 years old
Beth is 39 years old