Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

******************************* NOTE************* Using PYTHON **************************************************** This is the 3rd attempt to get the right answer for this question. You will get Errors : Traceback (most

image text in transcribed

******************************* NOTE*************

Using PYTHON

****************************************************

This is the 3rd attempt to get the right answer for this question.

You will get Errors :

Traceback (most recent call last): File "C:/Users/ruben/Desktop/learning to code cool file/R_Arroyo_homework3.py", line 2, in input_list = list(map(int, input("Enter a list containing integers: ").split())) ValueError: invalid literal for int() with base 10: '1,2,3,4'

or

Traceback (most recent call last): File "C:/Users/ruben/Desktop/learning to code cool file/R_Arroyo_homework3.py", line 15, in lst = list(map(int, input("Enter a list containing integers: ").split())) ValueError: invalid literal for int() with base 10: '1,2,3,4'

The other chegg answer were not able to prosses more then one number at a time (like the instructions say "Enter a list containing integers: [5,4,10,20,15,19]")

Homework3 (15pts) Enter the target value: 38 Write a program that uses functions to solve the problem below: Add a function, subsetSupl(), to your program that takes as input a list of positive integers and a positive number target. Your function should display an addition expression of the numbers that add up to the target value and return True if there are three numbers in the list that add Target list entered: [5,4,10,20,15,19] up to target. For example, if the input is list [5,4,10,20,15,19] and the target value is 38 , then the function should display 4+15+19=38 and return True because 4+15+19=38. However, the same input list [5,4,10,20,15,19] and target 10 should not display an addition expression and returns False: Target value entered: 38 1. The program will prompt the user to enter the list and the target value 2. The program will call subsetSum() and pass the list and target value as arguments 4+15+19=38 3. The function will determine whether 3 numbers in the list add up to the target value a. Display an addition expression in the function and return True Function return value: True 4. If three numbers in the list do not add up to the target value a. Function returns False 5. Display the function return value in the program Include the following in your program logic 1. Program prompts for the list and target values 2pts 2. Function subset Sum() is defined with the correct number of parameters 2pts 3. Call the subsetSum() function and pass the list and target values as arguments 1 pt 4. Function uses selection structure to determine if 3 numbers in the list add up to the target value or not 5pts 5. Function displays addition expression 2pts 6. Function returns True or False 1.5pts 7. Program displays function return value 1.5pts Enter the target value: 10 Target list entered: [5,4,10,20,15,19] Target value entered: 10 Example Program Runs: Example 1 Function return value: False Enter a list containing integers: [5,4,10,20,15,19] Important: If your program does not run, that's an automatic 50% deduction Homework submission details

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

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

Identify and control your anxieties

Answered: 1 week ago

Question

Understanding and Addressing Anxiety

Answered: 1 week ago