I'm getting into Python so my knowledge of syntax and formatting is very limited, but I was hoping someone would take the time to help me finish this code. I'm trying to create a simple program to help me practice. Here is the gist of what I am trying to do.
I'm trying to calculate how my hours it would take to reach the max level (designated in experience) for each skill, and then calculate the total hours it would take for them all.
The calculation: total hours per skill = (The max experience - my current experience) / exp per hour
I thought since there were 23 skills in total, I was hoping I could make them into dictionaries where I could pull their key and value, and use other dictionaries to store the other values. Here is where I started. *Note, the value "1" for current_exp are just placeholders, and total_hours is where I'd like to store the total hour per skill from the calculation.
max_exp = 13034431
current_exp = {
"Attack": 5574171,
"Strength": 13043713,
"Defence": 5388961,
"Range": 6179907,
"Prayer": 1900748,
"Magic": 6674380,
"Runecrafting": 687486,
"Construction": 3018183,
"Hitpoints": 10686667,
"Agility": 1342483,
"Herblore": 757889,
"Thieving": 13516382,
"Crafting": 1360543,
"Fletching": 5045556,
"Slayer": 2068113,
"Hunter": 1626552,
"Mining": 2515500,
"Smithing": 1347780,
"Fishing": 1362434,
"Cooking": 8670711,
"Firemaking": 5022270,
"Woodcutting": 1139504,
"Farming": 11122183,
}
est_hourly_exp = {
"Attack": 1,
"Strength": 1,
"Defence": 1,
"Range": 1,
"Prayer": 1,
"Magic": 1,
"Runecrafting": 1,
"Construction": 1,
"Hitpoints": 1,
"Agility": 1,
"Herblore": 1,
"Thieving": 1,
"Crafting": 1,
"Fletching": 150000,
"Slayer": 1,
"Hunter": 1,
"Mining": 1,
"Smithing": 1,
"Fishing": 1,
"Cooking": 225000,
"Firemaking": 1,
"Woodcutting": 1,
"Farming": 1,
}
total_hours = {
"Attack": 1,
"Strength": 1,
"Defence": 1,
"Range": 1,
"Prayer": 1,
"Magic": 1,
"Runecrafting": 1,
"Construction": 1,
"Hitpoints": 1,
"Agility": 1,
"Herblore": 1,
"Thieving": 1,
"Crafting": 1,
"Fletching": 1,
"Slayer": 1,
"Hunter": 1,
"Mining": 1,
"Smithing": 1,
"Fishing": 1,
"Cooking": 1,
"Firemaking": 1,
"Woodcutting": 1,
"Farming": 1,
}
#This is to compile them on a new line each time
[print(key,':',value) for key, value in current_exp.items()]
#This is my calculation for a single skill
total_hours = (max_exp - current_exp["Fletching"]) / est_hourly_exp["Fletching"]
#I couldn't figure out how to add "total_hours" into the same print function as the one below
print("This is the total hours it would take with this skill:")
print(total_hours)
Now I'm confident there are a million ways to do this easier (probably a for loop, but I don't understand them), but I'm not entirely sure how to go about it. IDEALLY, I'd like to take my calculation (or one that works) and store each INDIVIDUAL value I get from each skill (ex. total_hours for "Fletching" = 26.5) so that instead of it printing the "current_exp" value, it would print the total amount of hours per skill.
Making it look nice is one thing I can work on independently, but getting a better understanding of a more fine tune approach and getting it to work would be appreciated. Thanks for your time!