Numbers
Data Types
Algorithms
Logic
import random test.describe("Fixe Tests") test.assert_equals(isOdd(3), "True") test.assert_equals(isOdd(42), "False") test.describe("Random Tests") for i in range(100) : N = random.randint(0, 10000) test.assert_equals(isOdd(N), str(N % 2 > 0))
- import random
- test.describe("Fixe Tests")
- test.assert_equals(isOdd(3), "True")
- test.assert_equals(isOdd(42), "False")
- test.describe("Random Tests")
- for i in range(100) :
- N = random.randint(0, 10000)
result = "False" if N % 2 == 0 else "True"test.assert_equals(isOdd(N), result)- test.assert_equals(isOdd(N), str(N % 2 > 0))
Numbers
Data Types
Algorithms
Logic
Given a positive number N, you have to return if N is odd.
Example:
-> N = 3, return "True"
-> N = 42, return "False"
Good Luck !
def isOdd(n) :
return "False" if n % 2 == 0 else "True"
import random
test.describe("Fixe Tests")
test.assert_equals(isOdd(3), "True")
test.assert_equals(isOdd(42), "False")
test.describe("Random Tests")
for i in range(100) :
N = random.randint(0, 10000)
result = "False" if N % 2 == 0 else "True"
test.assert_equals(isOdd(N), result)