Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in python to collect fractional numbers (e. float) from the user. The program should be read in numbers until user types 'done'.

Write a program in python to collect fractional numbers (e. float) from the user. The program should be read in numbers until user types 'done'. If what the user writes is not a legal fraction then on the program to print 'Invalid input' and then continue reading in numbers. Once the user has typed 'done', the program should prompt the user for one more number, call this number the pivot. It can be assumed that the user does not make any mistakes here, i.e. pivot is always a legal fraction. The program should then first print out all the numbers that are smaller than the pivot, in the same order as the numbers were read in, and then in the next line all numbers greater than the pivot number. When the numbers are printed out, all numbers should be fractional numbers (e. float) and with spaces between numbers. Examples: Value: 23.1 Value: 18.8 Value: 54.4 Value: 23.9 Value: 13.5 Value: 34.1 Value: done Pivot: 23.5 23.1 18.8 13.5 54.4 23.9 34.1 Value: svdljkj Invalid input Value: 232.32lj23.23 Invalid input Value: 2.1.2.1 Invalid input Value: 23 Value: 24 Value: 19 Value: 17 Value: done Pivot: 20 19.0 17.0 23.0 24.0 Value: 1 Value: 3 Value: 2 Value: 4 Value: 7 Value: 5 Value: 6 Value: 8 Value: done Pivot: 5.5 1.0 3.0 2.0 4.0 5.0 7.0 6.0 8.0 Value: 23 Value: 24 Value: 21 Value: done Pivot: 10 23.0 24.0 21.0 Value: 1 Value: 3 Value: done Pivot: 2 1.0 3.0

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

More Books

Students also viewed these Databases questions

Question

3. How frequently do the assessments occur?

Answered: 1 week ago