Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this lab, we will learn to: 1. Use docstrings and inline comments to document Python programs 2. Initialize and use variables with descriptive names

In this lab, we will learn to: 1. Use docstrings and inline comments to document Python programs 2. Initialize and use variables with descriptive names 3. Use integers and floating-point numbers to make arithmetic calculations 4. Request input from a user. Part 1. Convert seconds to hours, minutes, and seconds. A day has 86,400 seconds (24*60*60). Write some code that asks the user for a number of seconds between 0 and 86,399, and then outputs the time as hours, minutes, and seconds with a 24-hour clock. Example. 56330 seconds is 15 hours, 38 minutes, 50 seconds Example. 345 seconds is 0 hours, 5 minutes, 45 seconds Here is some example output. Part 2. Estimate population. According to the US Census Bureau there is a birth every 7 seconds, a death every 13 seconds, and a new immigrant every 35 seconds. The US population on January 1, 2022 was 334,205,119. Write some code that estimates that US population on January 20, 2022 at 12:15:20. Do not delete your code for part 1. Youll need it for part 3. Hint: On Jan 1st at 01:00:00, its been 0 days and 1 hour since the beginning of the year. Hint: On Jan 2nd at 01:00:00, its been 1 day and 1 hour since the beginning of the year. Here is some example output. 1

Part 3. Population change. Let the user enter the amount of seconds since the beginning of the year, and determine how much the US population has increased in that amount of time. Give the answer in terms of days, hours, minutes, and seconds. Here is some example output. Part 4. Advanced Calculation According to the International Flapjack Society (IFS), the amount of Flapjacks a country eats per day depends on the total population and is calculated as follows. 5 (population + 350)2 12 50 Using the above formula, estimate the amount of flapjacks eaten in the US when the population was 334,205,119. Round answer to the nearest flapjack. Dont import any modules for this portion (specifically dont load the math module). When youre ready to submit it should look like the following. This is your checkout criterion. Once you get it, show me. After I give you the thumbs up, upload your .py file to D2L. Your file name should be Lab2 firstName lastName.py

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions