블로그 이미지
흰색앵초

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

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

소수점 반올림밖에 못찾아서 어거지로 만들었음 -_-;

posted by 흰색앵초