Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python question using thonny! plz answer asap! thank u sorry not calculus its computer science Q Search Question 1 (15 points) This question will ask

python question using thonny!
plz answer asap! thank u image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
sorry not calculus its computer science
Q Search Question 1 (15 points) This question will ask you to do an exercise involving lists. You are asked to write a function fetch that takes in a list of positive, non-zero integers, and returns the smallest integer not in the list. For example, the smallest positive integer not in the list [1, 5, 2] is 3, so the function should return 3. You must also write a function get input from user that creates a list based on user input, which we will use to create the list for the first function. The two functions should be implemented as follows: Name: fetch Parameters: A list 'numbers of positive, non-zero integer values. Return value: The smallest positive integer not in the list. If an empty list is given, return the value 1. Name: get list from input Parameters: No parameters Return value: A list of positive, non-zero integers entered by the user. What it should do: Ask the user to enter a number(s) with the prompt 'Enter number(s): then convert their entered numbers to integer and store them in a list. Keep asking the user to enter numbers until they enter the word 'done', at which point you should return the list of all numbers entered. The user may enter just one number on a line, or they could enter a series of comma-separated numbers, in which case each of the numbers must be added to the list. If the user enters any values less than 1, do not add them to the list. For example, if the user enters "4,5-2" on one line, 4 and 5 should be added to the list, but-2 should not. You can assume the user will not enter any spaces, and only enter digits from 0-9 without any letters or special characters. LUCI OPU , U Un CuL WI 10M WILLOU uy cules 0 Speuld e rs. Filename You must write this program in a file called sequence.py. In the file, the two functions are already defined for you, and at the bottom of the file there are calls to the functions. Examples (as executed in Thonny) EXAMPLE 1: >>> %Run sequence.py Enter number(s): done EXAMPLE 2: >>> %Run sequence.py Enter number(s): 0 Enter number(s): done EXAMPLE 3: >>> %Run sequence.py Enter number(s): 1 Enter number(s): done EXAMPLE 4: >>> %Run sequence.py Enter number(s): 1 Enter number(s): 5 Enter number(s): 2 Enter number (s): done EXAMPLE 5: >>> %Run sequence.py Enter number(s): 1 Enter number(s): 2 Enter number(s): 3 Enter number(s): 4 Enter number(s): done EXAMPLE 6: >>> %Run sequence. py Enter number(s): 1,5,2 Enter number(s): 3,7,6 Enter number(s): 4,8 Enter number(s): done

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Explain how pricing tells a story about your product.

Answered: 1 week ago

Question

identify current issues relating to equal pay in organisations

Answered: 1 week ago