What is the output of print(format(0.8, '.0%'))?
Choose an answer
Tap an option to check your answer.
Correct answer: 80%.
Why this is the answer
The correct output is 80%. The format() function in Python, when used with the format specifier '.0%', formats a number as a percentage. The .0 part specifies zero decimal places, and the % part multiplies the number by 100 and appends a percent sign. Therefore, 0.8 multiplied by 100 is 80, and the percent sign is added, resulting in "80%". 8.8%: This would imply an incorrect multiplication or decimal handling. .08%: This would imply division by 100 instead of multiplication. 8%: This would imply multiplication by 10 instead of 100.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed