Popcorn Hack #1
number = 15
print(number)
15
Popcorn Hack #2
string = "name"
print(string)
boolean = True
print(boolean)
name
True
Popcorn Hack #3
currentName = "Samhita"
print(currentName)
currentName = "Bob"
print(currentName)
idk = "so"
print(currentName + " " + idk)
Samhita
Bob
Bob so
Popcorn Hack #4
num1 = 30
num2 = num1
print(num1 + num2)
60
Popcorn Hack #5
name = "John Doe"
print(name[0]+ " " + name[5])
currentName = "B"
print(currentName + name[5])
J D
BD
Homework
def print_people(people):
for person, age in people.items():
print(f"{person} is {age} years old")
def find_oldest_person(people):
oldest_age = max(people.values())
oldest_people = [person for person, age in people.items() if age == oldest_age]
print(f"The oldest person(s) is/are: {', '.join(oldest_people)} with an age of {oldest_age} years.")
people = {
"Samhita": 15,
"Anna": 23,
"Malia": 40,
"Gloria": 40
}
print("People in the dictionary:")
print_people(people)
find_oldest_person(people)
People in the dictionary:
Samhita is 15 years old
Anna is 23 years old
Malia is 40 years old
Gloria is 40 years old
The oldest person(s) is/are: Malia, Gloria with an age of 40 years.
x = 5
print(type(5))
<class 'int'>