import random import time def not_even(n): pizza_time = time.ctime() if n % 2 == 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))
odd_even=lambda n:int(__import__('requests').get(f'https://api.isevenapi.xyz/api/iseven/{n}/').json()['iseven'])- import random
- import time
- def not_even(n):
- pizza_time = time.ctime()
- if n % 2 == 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))
# TODO Write tests import solution # or from solution import example import time # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("test case") def test_case(): if time.ctime() == time.ctime(): test.assert_equals('its not even', 'its not even') or test.assert_equals('its still even', 'its still even')
import codewars_test as testfrom solution import odd_even- # TODO Write tests
- import solution # or from solution import example
- import time
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
@test.it("test case 1: Testing Odd Numbers")def test_case():for n in range(1, 10, 2):test.assert_equals(odd_even(n), 0)@test.it("test case 2: Testing Even Numbers")- @test.it("test case")
- def test_case():
for n in range(0, 10, 2):test.assert_equals(odd_even(n), 1)- if time.ctime() == time.ctime():
- test.assert_equals('its not even', 'its not even') or test.assert_equals('its still even', 'its still even')