擅长:python、mysql、java
<pre><code>#Below code should work, made 3 edits
aircraft = {'1':'Fighter Jet','2':'Airliner','3':'Bi-Plane','4':'Aerobatic Plane'}
#edit-1, corrected the dictionary ppm, should be using 1 as key and value should be a number
ppm = {'1':2.25,'2':1.75,'3':'1.00','4':1.50}
def flightcost(time, aircraft):
#edit -2 , as value in ppm is float and we cannot multiply int and float, converted minutes to float. Also it is ppm.get(aircraft) but not ppm.get(aircraft.code)
y = float(time)
x = ppm.get(aircraft)
return x * y
time = input('\nHow many minutes would you like to fly? Please enter 5 - 60 numbers only! \n')
print('\nHere are the aircraft simulators we have: \n')
for code,airplane in aircraft.items():
print('{} {}'.format(code, airplane))
aircraft = input('\nType in the numeric code for the plane you precmdferfer? \n')
#edit-3 - calling flightcost directly doesn't makes any sense, you should pass the parameters required
print('\nHere is your flight cost: ', flightcost(time,aircraft))
</code></pre>