Answer:
d = {"R":2.89,"P":3.09, "S":3.39, "N":0}
noofgallons = input("Enter number of Gallons:")
gastype = input("Enter Gas type/; R,P,S,N")
cwr = input("Is Car Was Requieed")
if(gastype == "R"):
gal == nooffgallons * d['R']
if (cwr=="y" and gal<10):
gal+=3.00;
elif(cwr=="y" and gal>=10):
gal+=1.25
elif(cwr=="n"):
gal=gal
elif(gastype==P):
gal== nooffgallons * d['P']
if(cwr="y" and gal<10):
gal+=3.00;
elif(cwr=="y"and gal>=10):
gal+=1.25
elif(cwr=="n"):
gal=gal
elif(gastype ==S):
gal=noofgallons *d['S']
if(cwr="y" and gal<10):
gal+=3.00;
elif(cwr=="y"and gal>=10):
gal+=1.25
elif(cwr=="n"):
gal=gal
print("tptal cost paid"+ gal)
The above program uses a dictionary for storing gasoline types and their cost, and dictionary is always constant, and hence its fulfilled the requirement of keeping it constant. And car wash is treated accordingly. And if elif else ladder has been used to calculate the total number of gallons.
Rest part is self explanatory.
Explanation:
The code is self explanatory.