Message Turncoat in a DM to get moderator attention

Users Online(? lurkers):
4 posts

i took this problem and wrote the weirdest, most inefficient solution


Posts: 3246

What is the issue?

Posts: 2358
i took this problem and wrote the weirdest, most inefficient solution

The issue: cute kitten is a faggot.

Posts: 580
i took this problem and wrote the weirdest, most inefficient solution

quit blogging faggot

Posts: 192
i took this problem and wrote the weirdest, most inefficient solution

so the problem was this:

  1. Define a function is_int that takes a number x as an input.
  2. Have it return True if the number is an integer (as defined above) and False otherwise.
  3. 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
This site contains NSFW material. To view and use this site, you must be 18+ years of age.