1
2
3
4
5
6
7
8
#!/usr/bin/python
fh = open("text")
lista= fh.readlines()
fh.close
lines = [lines[:-1] for lines in lista]
lines2=[int(i) for i in lines]
###############################
total=0
y=''
for x in lines2:
if x==y:
print y
total += x
y=x
print total
Ova poruka je od: https://arhiva.linux.hr/newbb/viewtopic.php?forum=8&topic_id=2355&post_id=14707