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
Asingle-geared blanking press has a stroke of 200 mm and a rated capacity of 320 kn. a cam driven ram is assumed to be capable of delivering the full press load at constant force during the last 15 percent of a constant-velocity stroke. the camshaft has an average speed of 90 rev/min and is geared to the flywheel shaft at a 6: 1 ratio. the total work done is to include an allowance of 16 percent for friction a) estimate the maximum energy fluctuation b) find the rim weight for an effective diameter of 1.2 m and a coefficient of speed fluctuation of 0.10
Answers: 1
question
Engineering, 04.07.2019 18:10
Manometers are good examples of measuring instruments, nowadays they are not as common as before. a)-capacitive probe gauges b)-gravitational gauges deformation ) gauges d)-digital gauges
Answers: 1
question
Engineering, 04.07.2019 18:10
What are the two (02) benefits, which may result from a successful implementation of preventive maintenance (pm) program in an organization? (clo3)a)- lean manufacturing b)-overlapping responsibilities c)-the planner is not qualified d)-accurate contractor information e)-reduction in equipment redundancies f)-accurate stores information
Answers: 3
question
Engineering, 04.07.2019 18:20
Refrigerant-134a enters the compressor of a refrigerator as superheated vapor at 0.14 mpa and -10°c at a rate of 0.05 ka/s and leaves at 0.8 mpa and 50°c. the refrigerant is cooied in the condenser to 0.72 mpa and 26'c. it is then throttled to 0.15 mpa. sketch the t-s diagram for the system and evaluate: 6) the rate of heat removai from the refrigerated space (kw), it) the power input to the compressor (kw), ii) the isentropic efficiency of the compressor (%), and iv) the cop of the refrigerator.
Answers: 2
You know the right answer?
16.20 Lab 7D: Eradicate Ternary Conditional Overview A gas station has a program that determines the...
Questions
question
English, 08.11.2021 14:00
question
Mathematics, 08.11.2021 14:00
question
Spanish, 08.11.2021 14:00
Questions on the website: 13722359