# list of video games
video_games = ["Valorant", "Apex legends", "Fortnite", "League of Legends", "Roblox"]
# iteration to list the video games to eventually take user input
print("Here is a list of some popular video games!")
for game in video_games:
print(game)
# user input
favorite_game = input("What is your favorite video game? ")
# if/else statements depending on the input of user
if favorite_game == "Valorant":
print("You are class!")
elif favorite_game == "Apex Legends":
print("That game is not good!!")
elif favorite_game == "Fortnite":
print("That game used to be good.")
elif favorite_game == "League of Legends":
print("Please stop playing that game.")
else:
print("Alright game.")
# dictionary for my stats
my_stats = {
"best_agent": "omen",
"adr": 178.8,
"kills": 26,
"deaths": 13,
"first_kills": 3,
"first_deaths": 1,
"hs_percent": 25,
"leg_percent": 0,
}
# selection/condition and mathematical expressions to calculate kd and fk/fd ratio from dictionary
print("But what is my K/D ratio and FK/FD ratio?")
kd = my_stats["kills"] / my_stats["deaths"]
print("My K/D ration is: ", kd)
if kd > 1:
print("Im a good player! I can get 1 kill for every death!")
elif kd < 1:
print("I'm so bad. I can't even get a kill for every death.")
fkfd = my_stats["first_kills"] / my_stats["first_deaths"]
print("My FK/FD ratio is: ", fkfd)
if fkfd > 1:
print("Im so good at getting the first kill in the round and not dying first!")
elif fkfd < 1:
print("I die first in the round more times than I'm able to get the first kill!")
print("What about my headshot to legshot ratio?")
# tester function to test zerodivison and value errors
def test_my_stats(stats):
try:
hs_leg_percent = my_stats["hs_percent"] / my_stats["leg_percent"]
except ZeroDivisionError as e:
print(f"Could not find the heashot to legshot ratio. Error: {e}")
if stats["adr"] < 0 or stats["kills"] < 0 or stats["deaths"] < 0:
raise ValueError("The ADR, kills, and death values should not be negative")
test_my_stats(my_stats)
Here is a list of some popular video games!
Valorant
Apex legends
Fortnite
League of Legends
Roblox
What is your favorite video game? Valorant
You are class!
But what is my K/D ratio and FK/FD ratio?
My K/D ration is: 2.0
Im a good player! I can get 1 kill for every death!
My FK/FD ratio is: 3.0
Im so good at getting the first kill in the round and not dying first!
What about my headshot to legshot ratio?
Could not find the heashot to legshot ratio. Error: division by zero