Skip to content

Commit

Permalink
ZH gyakorlás
Browse files Browse the repository at this point in the history
  • Loading branch information
VMatt013 committed Nov 23, 2022
1 parent dcaddd7 commit 9785fe2
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 11.07/Homework/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@
Output.write(f"{Lines[i]}\n" )
except:
break

newWord = ''.join([char for char in word if not (char in Blacklist or char in Blacklist.upper())])


for char in word:
if not (char in Blacklist or char in Blacklist.upper():
newWord += char



1 change: 1 addition & 0 deletions 11.21/Class/02_hossz.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84:39
1 change: 1 addition & 0 deletions 11.21/Class/04_kedvenc_mufaj.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
POP
16 changes: 16 additions & 0 deletions 11.21/Class/05_osszegzes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Boney M. - 284
Bonnie Tyler - 334
Dragonforce - 445
Dschinghis Khan - 460
Foster The People - 253
Gloryhammer - 265
Gopnik McBlyat - 261
Green Day - 288
Imagine Dragons - 392
Korpiklaani - 194
Linkin Park - 219
Nirvana - 279
Powerwolf - 739
Rick Astley - 213
Smash Mouth - 237
Steppenwolf - 216
2 changes: 2 additions & 0 deletions 11.21/Class/06_imagine_dragons_dalok.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
thunder
radioactive
3 changes: 3 additions & 0 deletions 11.21/Class/06_powerwolf_dalok.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
incense and iron
venom of venus
dancing with the dead
17 changes: 17 additions & 0 deletions 11.21/Class/07_torolt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Rick Astley Never Gonna Give You Up pop 213
Dragonforce Through the Fire and Flames metal 445
Boney M. Rasputin pop 284
Steppenwolf Born To Be Wild rock 216
Powerwolf Incense and Iron metal 240
Smash Mouth All Star rock 237
Nirvana Smells Like Teen Spirit rock 279
Gloryhammer The Unicorn Invasion of Dundee metal 265
Powerwolf Venom of Venus metal 208
Dschinghis Khan Moskau pop 275
Dschinghis Khan Dschinghis Khan pop 185
Bonnie Tyler Total Eclipse of the Heart pop 334
Gopnik McBlyat Snakes In Tracksuits hardbass 261
Foster The People Pumped Up Kicks pop 253
Powerwolf Dancing With The Dead metal 291
Green Day Boulevard of Broken Dreams rock 288
Korpiklaani Ievan polkka metal 194
55 changes: 55 additions & 0 deletions 11.21/Class/Main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
def beolvas():
with open("playlist.csv",'r') as File:
playlist = [ (lambda l : {'eloado' : l[0], "cim" : l[1], "mufaj" : l[2], "hossz" : int(l[3]) } )( line.strip().split(';') ) for line in File ]
return playlist

def teljes_hossz(playlist):
osszeg = sum([i["hossz"] for i in playlist])
m,s = osszeg // 60 ,osszeg % 60
with open("02_hossz.txt","w") as File:
File.write(f"{m}:{s}")

def leghosszabb_rockzene(playlist):
H = [i['hossz'] for i in playlist]
with open("leghosszabb_rockzene.txt",'w') as File:
File.write(playlist[H.index(max(H))]["cim"])

def leggyakoribb_mufaj(playlist):
mufaj = [i['mufaj'] for i in playlist]
M = {i : mufaj.count(i) for i in set(mufaj)}
count = [*M.values()]
with open("04_kedvenc_mufaj.txt","w") as File:
File.write( [ *M.keys() ][ count.index(max(count)) ].upper() )

def zeneket_csoportosit(playlist):
E = {}
for i in playlist:
E[i["eloado"]] = E.get(i["eloado"],0) + i["hossz"]
with open("05_osszegzes.txt","w") as File:
for eloado in sorted(E):
File.write(f"{eloado} - {E[eloado]}\n")

def zeneket_listaz(playlist,nev):
Dalok = [i["cim"].lower() for i in playlist if i["eloado"].lower() == nev.lower()]

with open(f"06_{nev.lower().replace(' ','_')}_dalok.txt","w") as File:
if Dalok:
for i in Dalok:
File.write(f"{i}\n")
else:
File.write("Nincs ilyen eloado a lejatszasi listaban!")

def zeneket_torol(playlist,nevek):
with open("07_torolt.txt","w") as File:
for i in playlist:
if not i['eloado'] in nevek:
File.write(f"{i['eloado']} {i['cim']} {i['mufaj']} {i['hossz']}\n")


L = beolvas()
teljes_hossz(L)
leghosszabb_rockzene(L)
leggyakoribb_mufaj(L)
zeneket_csoportosit(L)
zeneket_listaz(L,"POWERWOLF")
zeneket_torol(L,["Linkin Park","Imagine Dragons"])
1 change: 1 addition & 0 deletions 11.21/Class/leghosszabb_rockzene.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Through the Fire and Flames
20 changes: 20 additions & 0 deletions 11.21/Class/playlist.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Rick Astley;Never Gonna Give You Up;pop;213
Imagine Dragons;Thunder;pop;204
Dragonforce;Through the Fire and Flames;metal;445
Boney M.;Rasputin;pop;284
Steppenwolf;Born To Be Wild;rock;216
Powerwolf;Incense and Iron;metal;240
Smash Mouth;All Star;rock;237
Nirvana;Smells Like Teen Spirit;rock;279
Gloryhammer;The Unicorn Invasion of Dundee;metal;265
Powerwolf;Venom of Venus;metal;208
Imagine Dragons;Radioactive;rock;188
Dschinghis Khan;Moskau;pop;275
Dschinghis Khan;Dschinghis Khan;pop;185
Bonnie Tyler;Total Eclipse of the Heart;pop;334
Gopnik McBlyat;Snakes In Tracksuits;hardbass;261
Foster The People;Pumped Up Kicks;pop;253
Linkin Park;In The End;rock;219
Powerwolf;Dancing With The Dead;metal;291
Green Day;Boulevard of Broken Dreams;rock;288
Korpiklaani;Ievan polkka;metal;194

0 comments on commit 9785fe2

Please sign in to comment.