öpcaö variable refrenced before assignment
markotaht at gmail.com
markotaht at gmail.com
Wed Oct 9 10:20:43 EDT 2013
fail4 = "palgad.txt"
f4 = open(fail4, "r")
def koguarv_ridu failis(f):
for i, l in enumerate(f):
pass
return i+1
def palgad(f4):
palgad = 0
while True:
f4r = f4.readline()
if f4r == "":
break
palgad += int(f4r[f4r.find(";")+1:])
return palgad
def kuu_keskmine(palgad, f):
return palgad/koguarv_ridu_failis(f)
print(kuu_keskmine(palgad(f4), f4))
Why does it give me local variable "i" referenced before assignment in koguarv_ridu_failis(f) on the return i+1 line
But if i do directly koguarv_ridu_failis(f4) then i get correct antswer.
More information about the Python-list
mailing list