Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3.2 Find the sum of all the elements from an input string consisting of numbers with any length. You need to loop the list by

3.2 Find the sum of all the elements from an input string consisting of numbers with any length. You need to loop the list by yourself and not use build-in functions like sum. You could use build-in functions to find out the length of the input list of you need it.

def sum_list (mylis):

mysum = 0

#your answer here (can be multiple lines of answer)

for ___

return mysum

print(sum_list ( [3,4,5] ) )

print(sum_list ([2,3]) )

This program should execute and print out:

12

5

3.3 Complete the main function that calls sum_list() and prints out the formatted answer.

def main ():

mylist=[6,7,2,3]

#your answer here (can be multiple lines of answer)

____

print (____)

main()

This program should execute and print out answer with the following format:

The sum of mylist is: 20

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

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions