Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following program is supposed to allow the user to enter a list of numbers, then print them out formatted with 2 decimal positions.

The following program is supposed to allow the user to enter a list of numbers, then print them out formatted with 2 decimal positions. However, there are 3 errors. Indicate the line number of each error and what you would change to fix each one. 123456789DUZENEA 10 11 1 def display_nums (nums): for num in nums: print (f'(num: 0.2d}') def read input(): input_str = input('Enter a list of numbers: ') nums = [] for s_num in input_str.split(): nums.append(float(s_num)) return nums def main(): nums = read_input display_nums (nums)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Here is the corrected version of the entire program def displaynumsnums ... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions