I just started learning Python at Uni and am a little confused on how to properly link two lists.
I need to write a program that uses inputed users name and age and compares it to a list of names and ages and prints a line such as "Eric is X years old and is older than (input all names of those younger" + same thing for those who are younger.
Im unsure how to link each name to an age then use this to print out only the names of those who are older/younger.
A proper printout would look like:
Ezekiel is 25 years old, and is younger than Bob and Zac.
Ezekiel is 25 years old, and is older than John, Eric, Tim, George.
We are not allowed to use dictionaries. Thanks.
name = input("What is your name of your character? ")
age = int(input("How old is your character? "))
names = ["John",
"Eric",
"Bob",
"Tim",
"George",
"Zac",]
ages = [59, 39, 12, 80, 26, 20,]
for items in ages:
if age > items:
print(f'{name} is {age} years old, and they are younger than {items}')