2012. 2. 12. 04:33
프로그래밍/파이썬
def roundup(num):
if 100000>num >=1000:
x = float(num)/10000
temp = round(x, 1)
resultround = temp*10000
return int(resultround)
elif num >= 100:
p = float(num)/1000
temp = round(p, 1)
resultround = temp*1000
return int(resultround)
elif num >= 10:
p = float(num)/100
temp = round(p, 1)
resultround = temp*100
return int(resultround)
else:return num
tempnum = roundup(18)
print tempnum
소수점 반올림밖에 못찾아서 어거지로 만들었음 -_-;