Answer to Question #344412 in Python for Kiran

Question #344412

Write a python program to print the following output.


Input

The first line of input contains a single line positive integer N.

The second line of input contains a space-separated integers denoting the cost of the item.


Output

The output is a single line integer.


Explanation

For example, Given N = 2 and cost = 10 200

Ram has to pay for both the items, he won't get anything for free.

So the output is 210.



Sample Input1

4

1 1 2 2

Sample Output1

4


Sample Input2

2

10 200

Sample Output2

210



1
Expert's answer
2022-05-25T14:32:53-0400
n = int(input("Enter the number of items: "))

entered_list = input("Enter a list of numbers separated by spaces: ").split()

num_list = list(map(int, entered_list))

print("Amount of purchases:", sum(num_list[0:n]))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS