Define a function named add

Assignment Help Basic Computer Science
Reference no: EM132183933

Define a function named add_from_one_again(st) which receives a list containing digits only (at least one digit, and all digits >0, no need to validate)  and returns a number as illustrated by the following examples

When the list is 

[5,2,3]

the resulting number should be:

(1+2+3+4+5) + (1+2) + (1+2+3)  = 24

When the list is 

[3,2,5]

the resulting number should be:

(1+2+3) + (1+2) + (1+2+3+4+5) = 24

When the list is

[4,2,2]

the resulting number should be:

(1+2+3+4) + (1+2) + (1+2) = 16

As an example, the following code fragment:

lst = [5,2,3]

print(add_from_one_again(lst))

should produce the output:

24

Language: python

I have this so far, but doesn't work:

def add_from_one_again(st):

collect_sum = 0

for i in st:

i = int(i)

collect_sum += sum(len(i))

return collect_sum

Reference no: EM132183933

Effectiveness of the new program

How could company policies or operating procedures harmonize with the new program. How was the effectiveness of the new program determined. How were rewards or incentives used

A population regression model

1. Assume that there is a population regression model y = β0 + β1x1 + β2x2 + β3x3 + u and that the model satisfies assumptions MLR1 through MLR5 in the population. Indicate,

Determines the total due including sales tax and shipping

Create an application that determines the total due including sales tax and shipping. Allow the user to input any number of item prices. Sales tax of 7.75% is charged agains

Problem regarding the networking with windows

The sales people at Company XYZ all use laptops, so they can take data with them on the road. You are a salesperson for a computer business and you are trying to talk Compan

Product review for identity governance-administration

North-by-East Software is a small but growing software development company. A recently completed risk assessment found that the company had very weak controls over the issua

Create a demo object and try its pickup test method

The taxi-company-outline project defines a Demo class to create a pair of Passenger Source and TaxiCompany objects. Create a Demo object and try its pickup Test method. Why

Write a commented c++ program to re-format dates

Write a commented C++ program to re-format dates. Prompt the user to input a date in the form: Sunday, January 2, 2010. Display the date in each of the following formats: Ja

Implement this stack by using a deque

If the stack is full when a push occurs, the stack makes room for the new entry by deleting the entry at its bottom. A browser that maintains a limited history could use thi

Reviews

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd