Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 : Write a python program that will get a collection of n numbers from the user. If the user entered 0 or a

Problem 2: Write a python program that will get a collection of n numbers from the user. If the user entered 0 or a negative number, the program terminates the process of entering numbers. The program uses the search () that is used to search a specified value by the user through the keyboard. If the value exists on the list of n numbers, the function returns how many times/ occurrences of that number from the given list. Otherwise, the program returns an appropriate message: "NO SUCH NUMBER!" and display it on the screen.
Sample Output:
Enter a number: 3
Enter a number: 2
Enter a number: 3
Enter a number: 2
Enter a number: 2
Enter a number: 3
Enter a number: 0
Enter the number to search: 4
NO SUCH NUMBER!
Do you want to search more (yn)=>y
Enter a number: 3
Enter a number: 2
Enter a number: 3
Enter a number: 2
Enter a number: 2
Enter a number: 3
Enter a number: -1
Enter the number to search: 3
There are 3 copies of "3" on my list.
Do you want to search more (yn)=>n
Press any key to continue
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago