-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap-filter-reduce5
More file actions
18 lines (15 loc) · 1.64 KB
/
Copy pathmap-filter-reduce5
File metadata and controls
18 lines (15 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'''pzt = [ { isim: 'Fonksiyonlara calis', sure: 180, }, { isim: 'ornek coz', sure: 120, }, { isim: 'odev kontrol', sure: 20, }, { isim: 'bayramlasma', sure: 200, }, ]
sali = [ { isim: 'gelecek haftaya hazirlik', sure: 240, }, { isim: 'ornek cozumlerine devam et', sure: 180, }, { isim: 'kahve molasi', sure: 10, }, { isim: 'kitap oku', sure: 200, }, { isim: 'spor yap', sure: 40, }, ]
Not: Sureler dakika cinsindendir!
Map, filter ve reduce kullanarak yukarida belirtilen iki gunluk plan neticesinde kac puan kazanilacagini hesaplayan bir program yaziniz.
• Map ile sureleri saat cinsine donusturun.
• Iki saatin altindaki tum rutinleri filter ile eleyin.
• Sureleri saatte 20 puan kazandiracak sekilde saatlik bazda guncelleyin.
• Kusurlu degerleri .round() ile yuvarlayin.
• Son olarak reduce ile kullanicinin kac puan kazandigini hesaplayin.
• Degisken isimlerinin duzgun ve anlasilir olmasina ozen gosterin.'''
from functools import reduce
pzt = [ { "isim": 'Fonksiyonlara calis', "sure": 180, }, { "isim": 'ornek coz', "sure": 120, }, { "isim": 'odev kontrol', "sure": 20, }, { "isim": 'bayramlasma', "sure": 200, }, ]
sali = [ { "isim": 'gelecek haftaya hazirlik', "sure": 240, }, { "isim": 'ornek cozumlerine devam et', "sure": 180, }, { "isim": 'kahve molasi',"sure": 10, }, {"isim": 'kitap oku', "sure": 200, }, { "isim": 'spor yap', "sure": 40, }, ]
print(reduce(lambda x,y:x+y,(map(lambda x:(x*20).__round__(),(filter(lambda x:x>=2,(map(lambda x:(list(x.values())[1]/60),pzt))))))))
print(reduce(lambda x,y:x+y,(map(lambda x:(x*20).__round__(),(filter(lambda x:x>=2,(map(lambda x:(list(x.values())[1]/60),sali))))))))