The code has to be UNIQUE . Please don't copy it from somewhere on the Internet or else my work will be charged plagiarised. The
The code has to be UNIQUE. Please don't copy it from somewhere on the Internet or else my work will be charged plagiarised.
The testing is a thing to test if the programs pass or not so please make sure it goes well
The question is not hard and just takes a short time to complete so please try to finish it asap.
Please, remove the word "Pass" under the description and type the code in.
#!/usr/bin/python3 import unittest # -------------------------------------------------------------- # Judging sameness # -------------------------------------------------------------- def same(a, b, c) : ''' Assume that a, b, c are numbers. Return 'all the same' if they are all equal, 'all different' if they are all different in value, or 'neither' otherwise. For example, same(9, 9, 9) returns 'all the same' same(9, 8, 2) returns 'all different' same(9, 2, 9) returns 'neither' ''' pass (Remove this word to type in the word) # -------------------------------------------------------------- # The Testing # -------------------------------------------------------------- class myTests(unittest.TestCase): def test1(self): self.assertEqual(same(1, 1, 1), 'all the same') def test2(self): self.assertEqual(same(2, 9, 3), 'all different') def test3(self): self.assertEqual(same(7, 7, 3), 'neither') def test4(self): self.assertEqual(same(6, 6, 6), 'all the same') def test5(self): self.assertEqual(same(4, 2, 4), 'neither') def test6(self): self.assertEqual(same(18, 18, 2), 'neither') def test7(self): self.assertEqual(same(14, 3, 7), 'all different')
if __name__ == '__main__': unittest.main(exit=True)
# -------------------------------------------------------------- # The End # --------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started