I have seen this Lab assignment on here already and I chose a different route to get the same result. However I keep getting dinged on the case of the variable. The input is inserted in capital, but when I use the variable in a string I get dinged because its uppercase. Any thoughts on a easy way to change it?
menu = {'Oil change' : 35, 'Tire rotation' : 19, 'Car wash' : 7}
service = input('Enter desired auto service:\n') #Zylab enters using Oil change uppercase O
print('You entered:', service)
if (service in menu):
print('Cost of {}: ${}'.format(service, menu.get(service))) #inserting into the string as uppercase but as part of the sentence needs to be lower case.
else:
print('Error: Requested service is not recognized')
I tried on line 8 to use:
print('Cost of {}: ${}'.format(service.lower, menu.get(service))) #No good
print('Cost of {}: ${}'.format.lower(service, menu.get(service))) #Not god either
I am still struggling a with formatting placements or if it is even possible.
You could change the line 8 to:
print('Cost of {}: ${}'.format(service.lower(), menu.get(service)))