How do i go about refactoring this code without using dictionaries. im having trouble understanding how to clean up all these if/else statements

#comparing Lord of The Rings characters to frodo, Gollum, Pippin, and Arwen's age

name_character=input("Enter the character's name:")
age_character=int(input("Enter the character's age:"))

#the characters we will be comparing out input to
pippin_age=29
frodo_age=51
gollum_age=589
arwen_age=2901

#comaprison
if age_character<0:
    print("invlaid age.")
#younger than all of them
elif age_character<pippin_age:
    print(name_character,"is",age_character,"years old, and they are younger than Pippin, Frodo, Gollum, and Arwen")
#older than pippin(29) younger than Frodo(51)
elif age_character>pippin_age and age_character<frodo_age:
    print(name_character,"is",age_character,"years old, and they are older than Pippin.")
    print(name_character,"is",age_character,"years old, and they are younger than Frodo, Gollum, and Arwen")
#older than frodo(51) younger than Gollum
elif age_character>frodo_age and age_character<gollum_age:
    print(name_character,"is",age_character,"years old, and they are older than Pippin, and Frodo")
    print(name_character,"is",age_character,"years old, and they are younger than Gollum, and Arwen")
#older than gollum(589) and younger than Arwen(2901)
elif age_character>gollum_age and age_character<arwen_age:
    print(name_character,"is",age_character,"years old, and they are older than Gollum,Pippin, and Frodo")
    print(name_character,"is",age_character,"years old,and they are younger than Arwen")
#older than all of them
else:
    print(name_character,"is", age_character,"years old, and they are older Pippin, Gollum, Frodo, and Arwen")

Im just having trouble wrapping my head around it

🔴 No definitive solution yet