Lab #4 (part-2)

active 6 years, 7 months ago
Lab #4 (part-2)
This Project is OPEN.
School / Office
Technology & Design
Project Description

Write a function that takes a list of numbers and returns the cumulative sum. For example, the cumulative sume of [1 ,2, 3] is [1, 3, 6].

a_str = input(“Please enter your first number: “)
b_str = input(“Please enter your second number: “)
c_str = input(“please enter your third number: “)
d_str = input(“Please enter your fourth number: “)

a = int(a_str)
b = int(b_str)
c = int(c_str)
d = int(d_str)

user_list = [a, b, c, d]
print (user_list)

sum_1 = a
sum_2 = a+b
sum_3 = a+b+c
sum_4 = a+b+c+d

cumulative_sum = [sum_1, sum_2, sum_3, sum_4]
print (cumulative_sum)

Recent Discussions

Sorry, there were no discussion topics found.

Recent Docs

No Recent Docs