Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve using python programming. In Exercises 47 and 48, rewrite the program using a for loop. 47. num = 1 while num

Please solve using python programming.

In Exercises 47 and 48, rewrite the program using a for loop.

47.

num = 1

while num <= 9: print(num) num += 2

Simplify the programs in Exercises 49 and 50.

49.

lakes = ["Erie", "Huron", "Michigan", "Ontario", "Superior"] result = "" for i in range(len(lakes)): result += lakes[i] if i < len(lakes) - 1: result += ", " print(result)

In Exercises 51 through 65, write a program to carry out the stated task.

51. Radioactive DecayCobalt-60, a radioactive form of cobalt used in cancer therapy, decays over a period of time. Each year, 12% of the amount present at the beginning of the year will have decayed. If a container of cobalt-60 initially contains 10 grams, determine the amount remaining after five years. Round the amount remaining to two decimal places. See Fig. 3.46.

The amount of cobalt-60 remaining after five years is 5.28 grams.

FIGURE 3.46 Outcome of Exercise 51.

53. VowelsCount the number of vowels in a phrase input by the user. See Fig. 3.48.

Enter a phrase: Less is more. The phrase contains 4 vowels.

FIGURE 3.48 Possible outcome of Exercise 53.

55. Sum of FractionsFind the value of 1+1/2+1/3+1/4++1/1001+1/2+1/3+1/4++1/100 to five decimal places. See Fig. 3.50.

The sum 1 + 1/2 + 1/3 + ... + 1/100 is 5.18738 to five decimal places.

FIGURE 3.50 Outcome of Exercise 55.

57. Alphabetical OrderAccept a word as input and determine if its letters are in alphabetical order. Some examples of words whose letters are in alphabetical order are biopsy, adept, chintz, and lost. See Fig. 3.52.

Enter a word: almost Letters are in alphabetical order.

FIGURE 3.52 Possible outcome of Exercise 57.

59. Lifetime EarningsEstimate how much a young worker will earn before retiring at age 65, where the workers name, age, and starting salary are input by the user. Assume the worker receives a 5% raise each year. See Fig. 3.54.

Enter name: Helen Enter age: 25 Enter starting salary: 20000 Helen will earn about $2,415,995.

FIGURE 3.54 Possible outcome of Exercise 59.

61. Car LoanConsider the car loan discussed in Exercise 23 of Section 3.3. The loan will be paid off after five years. Assume that the car was purchased at the beginning of January 2013, and display the balance at the end of each year for five years. See Fig. 3.56. Note: The last payment will be slightly less than the other payments, since otherwise the final balance would be a negative amount.

 AMOUNT OWED AT YEAR END OF YEAR 2013 $12,347.85 2014 $9,532.13 2015 $6,542.74 2016 $3,368.97 2017 $0.00

FIGURE 3.56 Outcome of Exercise 61.

63. Average GradeAsk the user to enter three grades, and then compute the average after dropping the lowest grade. See Fig. 3.58.

Enter a grade: 70 Enter a grade: 90 Enter a grade: 80 Average: 85

FIGURE 3.58 Possible outcome of Exercise 63.

65. Supply and DemandEach years level of production and price (per bushel) for most agricultural products affects the level of production and price for the following year. Suppose the soybean crop in a country was 80 million bushels in 2014 and

[price each year]=20.1 * [quantity that year][price each year]=20.1 * [quantity that year]

[quantity each year]=5 * ([price from the preceding year])10 [quantity each year]=5 * ([price from the preceding year])10

where quantity is measured in units of millions of bushels. Generate a table to show the quantity and price from 2014 until 2018. See Fig. 3.60.

YEAR QUANTITY PRICE 2014 80.00 $12.00 2015 50.00 $15.00 2016 65.00 $13.50 2017 57.50 $14.25 2018 61.25 $13.88

FIGURE 3.60 Outcome of Exercise 65.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

Are the rules readily available?

Answered: 1 week ago

Question

Have ground rules been established for the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago