What is the issue?
4
posts
so the problem was this:
- Define a function
is_int
that takes a numberx
as an input. - Have it
return True
if the number is an integer (as defined above) andFalse
otherwise. - we'll also say that a number with a decimal part that is all 0s is also an integer, such as
7.0
.
and i wrote this:
def is_int(x): num = str(x) for i,n in enumerate(num): if n == ".": for j in range(i+1,len(num)): print(j) if num[j] != "0": return False else: return True else: if i == len(num)-1: return True if is_int(3.4) == False: print("0:success") if is_int(2) == True: print("1:success") if is_int(2.0) == True: print("2:success")
lol
4
posts