Question

In: Computer Science

Question 9: pi = 3.14159 formatted = _______.format(pi) print("Pi day sale! All pies", formatted, "off.") Fill...

Question 9:
pi = 3.14159
formatted = _______.format(pi)
print("Pi day sale! All pies", formatted, "off.")

Fill in the blank so that the following program prints:

Pi day sale! All pies $3.14 off.

Question 11:

Complete the following program that keeps asking for a price until the user just presses the enter key. Assume the user only enters floating point values. The program totals the values entered by the user and print out the result.

total = 0
while True:
    ans = input("Enter a number or nothing when done:")
    if _____________ :
        break
    total = _________________
    
print("The total is",total)

Question 12:

Complete the following fragment of a program that asks for an integer from 1 through 9 (including 1 and 9). Assume the user only enters integers. The program should keep asking until the user enters a number in range.

while True:
    x = int(input("Enter a positive single digit integer:"))
    if _____________ :
        break
print("You chose", x)

Question 13:

Fill in the blanks with Boolean comparisons to map the following temperatures to messages. Avoid the logical operators and/or/not.

temp is 55 degrees or lower is 'Cold'
temp is 88 degrees or higher is 'Hot'
temp between 55 and 88 degrees is 'Fair'
if temp ______________:
       print("Hot")
elif temp ______________:
       print("Fair")
else:
      print("Cold") 

Solutions

Expert Solution

Have a look at the below code. I have put comments wherever required for better understanding.

Question 9:

Question 11:

Question 12:

Question 13:

pi = 3.14159 
formatted = "${:.2f}".format(pi) # format the value
print("Pi day sale! All pies", formatted, "off.")

total = 0 

while True:
    ans = input("Enter a number or nothing when done:")
    if (ans==""):
        break
    total = total + float(ans)
    
print("The total is",total)

while True:
    x = int(input("Enter a positive single digit integer:"))
    if x not in range(1,10):
        break
print("You chose", x)

temp = int(input("Enter the tempearture: "))
if temp>=88:
       print("Hot")
elif temp in range(56,88):
       print("Fair")
else:
      print("Cold") 

Happy Learning!


Related Solutions

Fill in the format strings so that the print() statements below display the indicated values vertically aligned
Use pythonFill in the format strings so that the print() statements below display the indicated values vertically aligned as Class | Exam Type | Grade ---------- | ---------- | ------------- ECC102 | Midterm | 78.12 ECC104 | Final | 82.45 ECC108 | Makeup | 98.00 ECC200 | Resit | 100.00 Note that the Class column is aligned LEFT, Exam Type column is aligned MIDDLE, and Grade column is also aligned LEFT. Note also that you need to use the vertical...
The swim buyer ran a sale during Memorial Day on all coverups at $29.99. The following...
The swim buyer ran a sale during Memorial Day on all coverups at $29.99. The following are the results that sold during the weekend event: 200 Sarong coverups with a regular retail price of $39.00 320 Cotton coverups with a regular retail price of $44.00 Calculate the Total $ markdown for the sale, the Total sales generated, and the Markdown % for the sale.
Question 6:    Fill in the blank entries in the table. All values are in millions....
Question 6:    Fill in the blank entries in the table. All values are in millions. Country Adult Population Labour Force Employed Unemployed Unemployment Rate Labour-Force Participation Rate Japan 108.12 63.79 3.20 France 25.98 2.45 56.4 percent Germany 69.17 39.75 8.08 percent Please show all work (including mathematical formulas).
QUESTION 1 This goes for ALL fill in the blank questions- Do not use Commas or...
QUESTION 1 This goes for ALL fill in the blank questions- Do not use Commas or Periods in your answers, just the letter. If not, your answer will be marked wrong. The following events took place in June 2016. Senior Frogg’s prepares monthly financial statements. Senior Frogg’s. is in the business of making Mexican Food. Match each event with the choice that correctly describes the effect of the transaction on the accounting equation: Increase (+), Decrease (-), No effect (NE)....
Fill in all question marked areas of the grid and write the formula for each value...
Fill in all question marked areas of the grid and write the formula for each value together. Open-To-Buy Worksheet BOM Plan Sales Sales % to total Markdown $ Md % OTB Stock-To-Sales February 35,000 $9,000 11.5% $1,000 ???? ???? 3.88 March 41,000 $15,000 19.2% $2,000 13.3% 20,000 ???? April 44,000 $18,000 23.1% $2,000 ???? ???? ???? May 41,000 $15,000 ???? ???? 10.0% ???? 2.73 June 38,000 ???? 15.4% $3,000 ???? 12,000 ???? July ???? $9,000 ???? $2,500 ???? ???? 3.89...
These are all part of one question so it can be answered in paragraph format: 1....
These are all part of one question so it can be answered in paragraph format: 1. How is a theory different from a hypothesis? 2. How is a virus different from a bacterium? 3. Do viruses evolve? 4. List various factors that affect the current spread of COVID-19 in the biosphere. 5. How is correlation different from causation - particularly as it relates to the webquest below: Recently reports have come out in the media and from scientists that people...
Please answer ALL QUESTIONS Question 9- What is a greater factor in determining breath hold time?...
Please answer ALL QUESTIONS Question 9- What is a greater factor in determining breath hold time? oxygen levels or CO2 levels Question 14: How can kidneys increase the pH in your blood? a. excrete CO2 b.excrete H+ ions c. xcrete HCO3- ions d. Increase O2 Question 18: what is the next smallest tube after bronchioles in the lungs? question 22:What cell in the lungs secretes alveolar fluid and surfactant? a.type 2 cells b. alveolar macrophages c.type 1 cells
Answer all the question below. Table 2: 1 3 5 7 9 11 13 15 17...
Answer all the question below. Table 2: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 12.2373551424579 11.7708440253038 11.3114033194700 11.0981090241345 10.9917532871426 10.9633449623870 10.9328985186904 11.0609123182770 11.1447150124713 11.2994243413533 11.4699411879533 11.5862580969086 11.7887055678588 11.9277833926721 11.9332325617172 12.0027754228957 12.0455191817870 11.9895076044597 12.1161492247957 11.9142999902406 11.9523445384738 11.8444716643177 11.8325572681845 11.6394782554936 11.4409836766153     Visualize data in table 2 in a 2-dimensional plot using Matlab.     Interpolate data in table 2 to determine a value of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT