Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lista1 = open("studenci.txt")
- grupy = open("grupa.txt","w")
- imie=[]
- nazwisko=[]
- grupa=[]
- indeksy=[]
- for line in lista1:
- currentline=line.split(",")
- imie.append(currentline[0])
- nazwisko.append(currentline[1])
- grupa.append(currentline[2])
- doc_grupa=input("Podaj grupe: ")
- for i in range(0,len(imie)):
- if (grupa[i]==doc_grupa):
- indeksy.append(i)
- for x in indeksy:
- grupy.write(imie[x])
- grupy.write(" ")
- grupy.write(nazwisko[x])
- grupy.write(" ")
- grupy.write(grupa[x])
- grupy.write("\n")
- lista1.close()
- grupy.close()
- x=[]
- def avg(*arg):
- x=list(arg)
- n=len(x)
- if n==0:
- return 0
- else:
- return sum(x)/n
- print(avg(2,6))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement