Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago