Ad

I added 100 test cases, and put in the preloded code.

Added Testcases, and also made it so that it knew that 9+10=21 like from the meme.

Code
Diff
  • def testFunction(n):
        if n == 9 + 10:
            return 21 #haha funny number
        return eval(str(n))
    • def test(n):
    • return eval(n)
    • def testFunction(n):
    • if n == 9 + 10:
    • return 21 #haha funny number
    • return eval(str(n))

I changed the program so it does the modulation with a while loop.

Code
Diff
  • import random
    import time
    def not_even(n):
        pizza_time = time.ctime()
        while n > 1:
            n -= 2
        if n == 0:
            return 'its not even', pizza_time
        else:
            return 'its still not even', pizza_time
        return pizza_time
    n = random.randint(0, 10000)
     
    print(not_even(n))
    • import random
    • import time
    • def not_even(n):
    • pizza_time = time.ctime()
    • if n % 2 == 0:
    • while n > 1:
    • n -= 2
    • if n == 0:
    • return 'its not even', pizza_time
    • else:
    • return 'its still not even', pizza_time
    • return pizza_time
    • n = random.randint(0, 10000)
    • print(not_even(n))

Creates a fixed test for the denominator being zero, and makes it so that when it is zero None is returned.

Code
Diff
  • def division(a, b):
        if b == 0:
            return None
        return a / b
    • def division(a, b):
    • if b == 0:
    • return None
    • return a / b

I fixed the error in the test cases, and I added 99 more test cases that all are the same thing.