Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. girl = open("dziewczyny.txt", "w")
  2. boy = open("chlopcy.txt", "w")
  3. f = open("imie.txt", "r")
  4. tab = []
  5. tabg = []
  6. tabb = []
  7. for line in f:
  8.     tab.append(line.strip())
  9. for i in tab[0:-1]:
  10.     if i[-1:]=="a":
  11.         tabg.append(i)
  12.  
  13.     else:
  14.         tabb.append(i)
  15.  
  16. tabg.sort(key=len)
  17. tabb.sort(key=len)
  18. for i in tabg:
  19.     d=len(i)
  20.     girl.write(i+" "+str(d)+"\n")
  21.  
  22. for i in tabb:
  23.     p = len(i)
  24.     boy.write(i + " " + str(p) + "\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement