L
Lance Hoffmeyer
Hey all,
I'm new to python. I keep getting an error when running this.
I'm sure there is an easy fix but I can't figure it out.
What am I doing wrong? How do I fix it?
def even_odd_round(num):
if(round(num,2) + .5 == int(round(num,2)) + 1):
if(int(num,0) % 2): #an odd number
rounded_num = round(num,2) + .1
else: #an even number
rounded_num = round(num,2) - .1
rounded_num = int(rounded_num)
return rounded_num
even_odd_round(5.5)
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
I'm new to python. I keep getting an error when running this.
I'm sure there is an easy fix but I can't figure it out.
What am I doing wrong? How do I fix it?
def even_odd_round(num):
if(round(num,2) + .5 == int(round(num,2)) + 1):
if(int(num,0) % 2): #an odd number
rounded_num = round(num,2) + .1
else: #an even number
rounded_num = round(num,2) - .1
rounded_num = int(rounded_num)
return rounded_num
even_odd_round(5.5)
Traceback (most recent call last):
File "<interactive input>", line 1, in ?