#==========================================================# Name: macomber# Date: 2025.11.20# Notes: Hunger Games District Sort #==========================================================import randomimport timeimport os
# Clear The Screenos.system('CLS')
tribute_list = []
#------------------------------------------------------------------------# Get the number of tributes:#------------------------------------------------------------------------print("===========================================================")print(" W E L C O M E T O P A N E M ")print("===========================================================")print("The Reaping has begun. It’s time to choose the tributes.")print("Sort wisely—only the strongest will stand a chance.")print("")numtributes = int(input("How Many Tributes Will You Add (4-10)?"))os.system('CLS')
#------------------------------------------------------------------------#Loop Through The Tributes#------------------------------------------------------------------------for i in range(numtributes): print(f"==================") print(f"Participant #{i+1}:") print(f"==================") tname = input("Please Enter The Tribute Name: ") tscore = int(input("What Is The Tribute's Score (1-100): ")) tdistrict = 0 #--------------------------------------------------------------------- #Sort their district by score: #--------------------------------------------------------------------- if(tscore>=1 and tscore<=25): tdistrict = 12 elif(tscore>=26 and tscore<=50): tdistrict = 7 elif(tscore>=51 and tscore<=75): tdistrict = 4 elif(tscore>=76 and tscore<=100): tdistrict = 1 else: tdistrict = 0 #--------------------------------------------------------------------- # Add the tribute to the list (as a list)... # WOO... Slick! A List in a List!! #--------------------------------------------------------------------- tribute_list.append([tname, tscore, tdistrict]) print("") os.system('CLS')
#=============================================# Offer a chance to sort the participants:#=============================================print("How Do You Want The Participants Sorted?")print(" 1. By Name")print(" 2. By Score")print(" 3. By District")mychoice = int(input("Please Select an option (1-3): "))
#---------------------------------------------------------------------# Sort Alpha#---------------------------------------------------------------------if(mychoice==1): tribute_list.sort(key=lambda trib: trib[0].lower())
#---------------------------------------------------------------------# Sort Reverse Numerical Score#---------------------------------------------------------------------elif(mychoice==2): tribute_list.sort(key=lambda trib: trib[1], reverse=True)
#---------------------------------------------------------------------#Sort By District#---------------------------------------------------------------------else: tribute_list.sort(key=lambda trib: trib[2])
#---------------------------------------------------------------------#Clear The Screen#---------------------------------------------------------------------os.system('CLS')
print(f"=====================================")print(f" THE 25th Annual Hunger Games List")print(f"=====================================")
header_name = "Name".ljust(15)header_score = "Score".ljust(5)header_district = "District".ljust(8)line = "".center(34, "-")
#Print The Header Rowprint(f"{header_name} | {header_score} | {header_district}")print(line)
#---------------------------------------------------------------------#Loop Through The Participants#---------------------------------------------------------------------for count, tribute in enumerate(tribute_list, start=1): thename = str(tribute[0]).ljust(15) thescore = str(tribute[1]).ljust(5) thedistrict = str(tribute[2]).ljust(8)
print(f"{thename} | {thescore} | {thedistrict}")