Python Code
Im working on a homework for python. having an issue with the assert equal saying that true isnt defined
def is_multiple(num1,num2):
if num1%num2 == 0:
return true
else: return false
assert_equal(is_multiple(12,3),true)
assert_equal(is_multiple(36,6),true)
assert_equal(is_multiple(17,4),false)
any help would be great thanks
if you have any problem let me know i will try to help you .Thank you.
''' if you want to use assert_equal()
then you have to import the below two Module
because this method is available in numpy
module.
So below is the correct code.ModuleNotFoundError'''
import numpy as np
import numpy.testing as npt
def is_multiple(num1,num2):
if num1%num2 == 0:
return True
else:
return False
npt.assert_equal(is_multiple(12,3),True)
npt.assert_equal(is_multiple(36,6),True)
npt.assert_equal(is_multiple(17,4),False)
Get Answers For Free
Most questions answered within 1 hours.