Question
ANWER THE FOLLOWING IN PYTHON AND PUT THE ANSWER IN THE QUESTION WHERE IT IS SUPPOSED TO BE : #!/usr/bin/python3 import unittest def func9(lis1, lis2):
ANWER THE FOLLOWING IN PYTHON AND PUT THE ANSWER IN THE QUESTION WHERE IT IS SUPPOSED TO BE :
#!/usr/bin/python3
import unittest
def func9(lis1, lis2):
'''
Assume lis1 and lis2 are lists of integers and/or lowercase letters.
Return a list of the combination of letters in the two lists in ascending order.
Note 1: No duplicates in the output
Note 2: Return None if the output is empty
Note 3: you may use isinstance(d, int) or isinstance(d, str) to check the type of d
Note 4: you may use sort() or sorted()
For example, func9(['b', 'a', 3], ['b', 2, 'a', 'a']) should return ['a', 'b']
func9([2, 3], [6, 5]) should return None
'''
# YOUR CODE GOES HERE
# YOUR CODE GOES ABOVE HERE
pass
# --------------------------------------------------------------
# The Testing
# --------------------------------------------------------------
class myTests(unittest.TestCase):
def test1(self):
self.assertEqual(func9([1, 2, 3, 'a', 'b', 'c'], [12, 13, 'b']), ['a', 'b', 'c'])
def test2(self):
self.assertEqual(func9([11, 'c', 'b', 'c'], ['a', 11, 'c']), ['a', 'b', 'c'])
def test3(self):
self.assertEqual(func9(['d', 'e', 2, 5, 3, 'a', 'b'], [3, 2, 'f']), ['a', 'b', 'd', 'e', 'f'])
def test4(self):
self.assertEqual(func9(['d', 'b', 2, 5, 3, 'a', 'b', 'd'], ['d', 'b', 'b']), ['a', 'b', 'd'])
def test5(self):
self.assertEqual(func9([5, 5], [2, 5, 3]), None)
if __name__ == '__main__':
unittest.main(exit=True)
# --------------------------------------------------------------
# The End
# --------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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