def main():
    tlist = [10, 21, 27, 35, 0, -42, -23, 666, 123, 000]
    for a in tlist:
        if (is_even(a) == True):
            print("a is even", a)
        else:
            print("a is odd", a)
def main():
    data = [{
        "data": 10,
        "exp_result": True
    }, {
        "data": 15,
        "exp_result": False
    }, {
        "data": 0,
        "exp_result": False
    }, {
        "data": -0,
        "exp_result": False
    }, {
        "data": -15,
        "exp_result": False
    }]
    for a in data:
        rvalue = is_even(a["data"])
        if (rvalue != a["exp_result"]):
            print(
                f"For {a['data']} is_even retval :{rvalue} expected :{a['exp_result']}, FAIL"
            )
        else:
            print(
                f"For {a['data']} is_even retval :{rvalue} expected :{a['exp_result']}, PASS"
            )
def main():
    data = [[10, True], [21, False], [27, False], [35, False], [0, False],
            [-42, False], [23, False], [666, True], [123, False], [000, False]]
    for a in data:
        rvalue = is_even(a[0])
        if (rvalue != a[1]):
            print(
                f"For {a[0]} is_even retval :{rvalue} expected :{a[1]}, FAIL")
        """
Example #4
0
def main():
	data = [
			[10,True],
			[21,False],
			[27,False],
			[35,False],
			[0,False],
			[-42,False],
			[23,False],
			[666,True],
			[123,False],
			[000,False]
			] 
	for a in data:
		rvalue = is_even(a[0])
		if(rvalue != a[1]):
			print(a[0],"fail")
		else:
			print(a[0],"pass")
def main():
    data = [{
        "data": 10,
        "exp_result": True
    }, {
        "data": 15,
        "exp_result": False
    }, {
        "data": 0,
        "exp_result": False
    }, {
        "data": -0,
        "exp_result": False
    }, {
        "data": -15,
        "exp_result": False
    }]
    for a in data:
        rvalue = is_even(a["data"])

        assert rvalue == a[
            "exp_result"], f"For {a['data']} is_even retval :{rvalue} expected :{a['exp_result']}"
Example #6
0
#!/usr/bin/env python
import amath

numbers = [3,6,28,69,88,121,496,137438691328]
line = str('-'*40)

for n in numbers:
    print('is_perfect(%d) = %s'    % (n, amath.is_perfect(n)))
    print('is_palindrome(%d) = %s' % (n, amath.is_palindrome(n)))
    print('is_even(%d) = %s'       % (n, amath.is_even(n)))
    print('is_odd(%d) = %s'        % (n, amath.is_odd(n)))
    print('is_prime(%d) = %s'      % (n, amath.is_prime(n)))
    print(line)

print('get_facts(%s) = %s\n%s'   % (numbers[3], amath.get_facts(numbers[3]), line))
print('facts(%s) = %s\n%s'       % (numbers[3], amath.facts(numbers[3]), line))
print('facts(%s) = %s\n%s'       % (numbers, amath.facts(numbers), line))
print('facts(%s,%s) = %s\n%s'    % (numbers[1], numbers[2], amath.facts(numbers[1], numbers[2]), line))
print('facts(%s,%s,%s) = %s\n%s' % (numbers[1], numbers[2], numbers[3], amath.facts(numbers[1], numbers[2], numbers[3]), line))
Example #7
0
#!/usr/bin/env python
import amath

numbers = [3, 6, 28, 69, 88, 121, 496, 137438691328]
line = str('-' * 40)

for n in numbers:
    print('is_perfect(%d) = %s' % (n, amath.is_perfect(n)))
    print('is_palindrome(%d) = %s' % (n, amath.is_palindrome(n)))
    print('is_even(%d) = %s' % (n, amath.is_even(n)))
    print('is_odd(%d) = %s' % (n, amath.is_odd(n)))
    print('is_prime(%d) = %s' % (n, amath.is_prime(n)))
    print(line)

print('get_facts(%s) = %s\n%s' %
      (numbers[3], amath.get_facts(numbers[3]), line))
print('facts(%s) = %s\n%s' % (numbers[3], amath.facts(numbers[3]), line))
print('facts(%s) = %s\n%s' % (numbers, amath.facts(numbers), line))
print('facts(%s,%s) = %s\n%s' %
      (numbers[1], numbers[2], amath.facts(numbers[1], numbers[2]), line))
print('facts(%s,%s,%s) = %s\n%s' %
      (numbers[1], numbers[2], numbers[3],
       amath.facts(numbers[1], numbers[2], numbers[3]), line))
def main():
    a = 10
    if (is_even(a) == True):
        print("a is even")
    else:
        print("a is odd")
Example #9
0
def main():
	a = int(input("enter any number:"))
	if(is_even(a) == True):
		print("a is even")
	else:
		print("a is odd")
Example #10
0
def test_phone_number():
    for a in data:
        rvalue = is_even(a["data"])
        assert rvalue == a[
            "exp_result"], f"For {a['data']} is_even retval :{rvalue} expected :{a['exp_result']}"
def test_phone_number(ipd):
    print(ipd)
    rvalue = is_even(ipd["data"])
    assert rvalue == ipd[
        "exp_result"], f"For {ipd['data']} is_even retval :{rvalue} expected :{ipd['exp_result']}"
Example #12
0
def main():
    for a in range(10):
        if (is_even(a) == True):
            print("a is even", a)
        else:
            print("a is odd", a)