I have just begun learning Python and I got stuck (1day experience :)). Couldn't you help me with my homework?
We have module checkers with function is_triangle
The method signature with a documentation string:
def is_triangle(a, b, c):
:param a: length of first side
:param b: length of second side
:param c: length of third side
:return: "True" if possible to create triangle with these sides. Otherwise "False"
.py file you should write
import nose.tools as nt from checkers import is_triangle def test_is_triangle(): # Define test_a, test_b, and test_c here such that they should produce a # return value of False. nt.assert_false(is_triangle(test_a, test_b, test_c)) # Redefine test_a, test_b, and test_c here such that they should produce a # return value of True. nt.assert_true(is_triangle(test_a, test_b, test_c))
You should then run this script in one of two ways:
$ nosetests your_file_name.py
$ python your_file_name.py # as your instructor has requested.
The test should fail until you have a properly written
is_triangle function. If you find that your initial tests are inadequate -- such that the tests pass even though
is_triangle is incorrect -- add more.