def funk(x,y):
try:
ret=x/y
except ZeroDivisionError:
ret="y ne moze biti 0!"
except TypeError:
ret="x i y moraju biti brojevi!"
return ret
def vratiClan(x,y):
try:
ret=x[y]
except:
ret="Neispravni indeks!"
return ret
def vratiClan(x,y):
try:
ret=x[y]
except TypeError:
ret="Neispravni indeks!"
except:
ret="Indeks izvan raspona!"
return ret
def vratiClan(x,*argy):
i=0
for y in argy:
i+=1
try:
ret=x[y]
except TypeError:
ret="Neispravni indeks!"
except:
ret="Indeks izvan raspona!"
print(str(i)+": "+str(ret))
import csv
def zapis(a):
with open("out.csv", mode='w') as fout:
fwr = csv.writer(fout,delimiter=';')
for row in a:
fwr.writerow(row)
import csv
def zapis(a,f,d):
try:
with open(f+".csv", mode='w') as fout:
fwr = csv.writer(fout,delimiter=d)
for row in a:
fwr.writerow(row)
return True
except:
return False
import csv
def prov(f):
with open(f, mode='r') as fin:
fre = csv.reader(fin,delimiter=";")
for row in fre:
a=0
for col in row:
try:
a+=float(col.replace(',','.'))
except:
err="err"
if a<5:
ret="nije OK"
else:
ret="OK"
print(row[0]+" "+row[1]+":\t "+ret)