-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7may.py
More file actions
24 lines (18 loc) · 739 Bytes
/
7may.py
File metadata and controls
24 lines (18 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""def hugeTransactions(transaction):
return abs(transaction) >= 50000
transactions = [1000, 25000, -31000, -60000, 40000, 49900, 120000, -70000]
bigTransactions = []
for i in transactions:
if hugeTransactions(i) == True:
bigTransactions.append(i)
print(bigTransactions) """
def absoluteTotal(a, b):
return abs(a) + abs(b)
transactions = [1000, 25000, -31000, -60000, 40000, 49900, 120000, -70000]
# april = [10, -10, 20, -20]
# print(absoluteTotal(10, -10))
# Use above function and the list of transaction, use the topics taught (especially for loop) and write your code below to get total amount transacted.
sum = 0
for i in transactions:
sum = absoluteTotal(sum,i)
print(sum)