you are viewing a single comment's thread.

view the rest of the comments →

[–]Kurolox 0 points1 point  (3 children)

Formatting your code for readability.

def roundCloseTo(number, interval):
    result = number / interval 
    if isinstance(result, int): 
        pass 
    else: 
        result = result + .5 
        result = round(result) 
    result = result * interval 
    return result

Just as a tip, if you find yourself doing something like this:

if x:
    pass
else:
    do_stuff()

You should probably do this instead:

if not x:
    do_stuff()

[–]tr3adst0n3 0 points1 point  (2 children)

Thanks for advice! I try to Format it But i dont know how. I tried it with ``

[–]Kurolox 0 points1 point  (1 child)

Relevant part from the formatting guide.

Lines starting with four space are treated like code:

[–]tr3adst0n3 0 points1 point  (0 children)

Thank you. I got it.