Skip to content

Commit

Permalink
11.07 Házi Fix 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
VMatt013 committed Nov 14, 2022
1 parent f4969d4 commit dcaddd7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions 11.07/Homework/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@
Blacklist = string.punctuation + "aáeéiíoóöőuúüű"
Lines = []

with open("hazi.txt",'r') as File:
for line in File:
with open("hazi.txt",'r') as Input:
for line in Input:
if not (line == '' or line == '\n'):
newLine = []
for word in line.strip().split(" "):
newWord = ''
for char in word:
if not (char in Blacklist or char in Blacklist.upper()):
newWord += char
newWord = ''.join([char for char in word if not (char in Blacklist or char in Blacklist.upper())])
if not newWord == '':
newLine.append(newWord)
Lines.append(" ".join(newLine))

with open("Eredmeny","w") as File:
with open("Eredmeny","w") as Output:
for i in range(2,len(Lines),3):
try:
File.write(f"{Lines[i]}\n" )
Output.write(f"{Lines[i]}\n" )
except:
break

0 comments on commit dcaddd7

Please sign in to comment.