question 1
Complete the exercise assigned to you below. Include the page, question number, and question in your post. Take a screen shot showing your code and the result. Add comments to make it easy for others to understand what is happening in your code.
In Exercises 39 and 40, assume that the 50 lines of the file States.txt contain the names of the fifty states in the order they joined the union.
42. for i in range(1, 4): print(i + ” ” + 2 ** i)
question 2
- Students will develop a simple program written in Python to solve a problem statement provided by the instructor. The program must include 15 to 40 instructions (excluding comments) that include sequential, conditional, and/or iterative programming structures to convert input into required output and apply the following concepts: Conditional Statements and Iterative Statements. Students must provide evidence that they have followed all stages of the Programming Lifecycle Process, including: Problem Statement, Problem Analysis, Logical Design, Coding, Editing (Debugging and Testing), and Documentation. Debugging log must be included as an appendix and will include sorted date and time stamps. Students will also write a brief reflection (one or two paragraphs) about new skills or insights they learned about programming from developing this program and how they can apply them to their current or future work.
3. Caffeine Absorption After caffeine is absorbed into the body, 13% is eliminated
from the body each hour. Assume a person drinks an 8-oz cup of brewed coffee con-
taining 130 mg of caffeine, and that the caffeine is absorbed immediately into the body.
Write a program to calculate the following values. See Fig. 3.81.
(a) The number of hours required until less than 65 mg (one-half the original amount)
remain in the body.
(b) The amount of caffeine in the body 24 hours after the person drinks the coffee.
(C) Suppose the person drinks a cup of coffee at 7 a.m. and then drinks a cup of coffee
at the end of each hour until 7 a.m. the next day. How much caffeine will be in the
body at the end of the 24 hours?
CAFFEINE VALUES
One cup: less than 65 mg. will remain after 5 hours.
One cup: 4.60 mg. will remain after 24 hours.
Hourly cups: 969.24 mg. will remain after 24 hours.
FIGURE 3.81
Outcome of Programming Project 3.