I want to know if there is a possible solution for my problem. I want add and return the integers from each dictionary if the string conditions 'Mars' and 'First' are satisfied. My for loop is not working, i need help. the printed value should be 230. Should I import a module or a package?
my code:
'''
planets = {
'Mercury':['Estimated travel duration time: 6.5 years','./static/Hohmann_Mercury.gif', 110],
'Venus':['Estimated travel duration time: 15 months', './static/Hohmann_Venus.gif',90 ],
'Mars': ['Estimated travel duration time: 7 months','./static/Hohmann_Mars.gif', 160],
'Jupiter': ['Estimated travel duration time: 6 years','./static/Hohmann_Jupiter.gif',300],
'Saturn':['Estimated travel duration time: 7 years','./static/Hohmann_Saturn.gif',515],
'Uranus':['Estimated travel duration time: 8.5 years','./static/Hohmann_Uranus.gif',800],
'Neptune':['Estimated travel duration time: 12 years','./static/Hohmann_Neptune.gif',960]}
prices = {'Economy':20, 'Business': 55, 'First': 70 }
planet = 'Mars'
price = "First"
for i in planets.keys() and prices.keys() :
if i == planet and i == price:
sum = planets.get(i)[2] + prices.get(i)[0]
print(sum)
'''