subject
Engineering, 22.02.2020 05:20 elijahjacksonrp6z2o7

16.20 Lab 7D: Eradicate Ternary Conditional Overview A gas station has a program that determines the type and price of gas depending on whether button A or button B was pressed on the pump. Unfortunately, the intern they hired last summer tried to impress them with how clever he was, and used the ternary conditional operator. Now there is a new pump with 3 buttons, A, B, and C, with different types of gas and prices. Your job is to fix the previous intern's code so that it will now work with the third option. Problem Description The user is first prompted for which button was pressed, A, B, (and now, the third option, C). Button A represents regular gas at a price of $2.45 per gallon. Button B represents premium gas at a price of $2.66 per gallon. The new button to be added, Button C, represents ethanol at a price of $2.20 per gallon. Exercise You should first study and run the template code to see what it does. See what happens when you input the third option, C. Then, change the code by using multi-branch if-else statements so that it handles the third option, C, correctly according to the above information. You should change the prompt appropriately, but you will not be graded on a specific prompt. Good practice is that you would also account for what happens when the user inputs something unexpected (that is something other than A, B, or C), such as by printing an error message. You may (and should do this, but your grade will be based only on the inputs A, B, and C. LAB ACTIVITY 16.20.1: Lab 7D: Eradicate Ternary Conditional 0/30 LAB ACTIVITY 16.20.1: Lab 7D: Eradicate Ternary Conditional 0/30 main. py Load default template... 2 button = input("Enter the button, A or B:") nmin 5 type = 'regular' if button == 'A' else 'premium' 6 price = 2.45 if button == 'A' else 2.66 8 # do not change the print line below 9 print("Button {f} was pressed which means {} gas at a price of ${:.2f} per gallon".Format(button, type, price))

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Coiled springs ought to be very strong and stiff. si3n4 is a strong, stiff material. would you select this material for a spring? explain.
Answers: 2
question
Engineering, 04.07.2019 18:10
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg.k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m.k
Answers: 2
question
Engineering, 04.07.2019 18:20
Avolume of 2.65 m3 of air in a rigid, insulated container fitted with a paddle wheel is initially at 264 k, 5.6 bar. the air receives 432 kj by work from the paddle wheel. assuming the ideal gas model with cv = 0.71 kj/kg • k, determine for the air the amount of entropy produced, in kj/k
Answers: 2
question
Engineering, 04.07.2019 19:10
What is the chief metrological difference between measuring with a microscope and with an electronic comparator? a. the microscope is limited to small workpieces.a. the microscope is limited to small workpieces. c. the comparator can only examine one point on the workpiece. d. the microscope carries its own standard.
Answers: 1
You know the right answer?
16.20 Lab 7D: Eradicate Ternary Conditional Overview A gas station has a program that determines the...
Questions
question
History, 27.05.2020 02:04
question
Mathematics, 27.05.2020 02:04
question
Arts, 27.05.2020 02:04
question
Biology, 27.05.2020 02:04
question
Mathematics, 27.05.2020 02:04
Questions on the website: 13722363