-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.py
More file actions
44 lines (27 loc) · 734 Bytes
/
map.py
File metadata and controls
44 lines (27 loc) · 734 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from dados import products, students, my_list
new_list = map(lambda x: x * 2, my_list)
print()
print(list(new_list))
new_list = [x * 2 for x in my_list]
print()
print(list(new_list))
for product in products:
print(product)
pricies = map(lambda p: p['price'], products)
for price in pricies:
print(price)
def increments_price(p):
p['price'] = round(p['price'] * 1.05, 2)
return p
new_products = map(increments_price, products)
for product in new_products:
print(product)
ages = map(lambda p: p['age'] * 1.20, students)
for age in ages:
print(age)
def increments_age(p):
p['new_age'] = round(p['age'] * 1.20)
return p
ages = map(increments_age, students)
for age in ages:
print(age)