Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = open("liukulukuja.txt", "r")
- b = open("valmiitalukuja.txt", "w")
- m=0
- while True:
- f = a.readline()
- w = f.strip("\n")
- q = w.strip()
- if len(q):
- x=float(q)
- c=round(x,2)
- b.write(str(c)+"\n")
- x = q.replace(".","")
- m+=len(x)
- if len(q)==0:
- break
- b.close()
- d = open("valmiitalukuja.txt", "r")
- total=0
- while True:
- g = d.readline()
- h = g.strip("\n")
- j = h.strip()
- if len(j):
- total += float(j)
- if len(j)==0:
- break
- print(total)
- print(m)
- a.close()
- d.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement