subject

Prompt: A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-life of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 24 hours. Use a string formatting expression with conversion specifiers to output the caffeine amount as floating-point numbers. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))< br />
Ex: If the input is:

100
the output is:

After 6 hours: 50.00 mg
After 12 hours: 25.00 mg
After 24 hours: 6.25 mg

my code:
caffeine_mg = float(input())

six_hours = caffeine_mg / 2
twelve_hours = six_hours / 2
twenty_four_hours = twelve_hours / 4

print('After 6 hours: {:.2f}'.format(six_hours))
print('After 12 hours: {:.2f}'.format(twelve_hours))
print('After 24 hours: {:.2f}'.format(twenty_four_hours))< br />
Question: How do I add "mg" at the end? This is my output
After 6 hours: 50.00
After 12 hours: 25.00
After 24 hours: 6.25

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:10, victoriadorvilu
This program reads a file called 'test. txt'. you are required to write two functions that build a wordlist out of all of the words found in the file and print all of the unique words found in the file. remove punctuations using 'string. punctuation' and 'strip()' before adding words to the wordlist. write a function build_wordlist() that takes a 'file pointer' as an argument and reads the contents, builds the wordlist after removing punctuations, and then returns the wordlist. another function find_unique() will take this wordlist as a parameter and return another wordlist comprising of all unique words found in the wordlist. example: contents of 'test. txt': test file another line in the test file output: ['another', 'file', 'in', 'line', 'test', 'the']
Answers: 1
image
Computers and Technology, 22.06.2019 04:00, tiatia032502
Which of the following kinds of programs displays an online advertisement in a banner or pop-up window on webpages, email, or other internet service? e
Answers: 2
image
Computers and Technology, 22.06.2019 17:50, ImBADatmath8743
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
You know the right answer?
Prompt: A half-life is the amount of time it takes for a substance or entity to fall to half its ori...

Questions in other subjects:

Konu
History, 12.08.2020 23:01