What does the statement print(format(0.8, '.0%')) display?
What does the statement print(format(0.8, '.0%')) display?
The statement print(format(0.8, '.0%')) formats the number 0.8 as a percentage with no decimal places. Multiplying 0.8 by 100 and then converting it to a percentage with no decimal places results in '80%'.
The statement print(format(0.8, '.2%')) will display the value 0.8 as a percentage with a precision of 2 decimal places, resulting in the output '80.00%'.
Option D, 80%
Provided answer is correct
D is correct. after reading the comments you say Ahaaa, that makes sense -_-
D is correct. after reading the comments you say Ahaaa, that makes sense -_- 0.8 * 100 = 80
If you only want the percentage to be displayed as '8%' without any decimals, you would need to use a different formatting specification, such as '0%'. With this specification, 0.8 would be displayed as '8%'.