Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I I would appreciate it if you can check whether my code is correct and write 5 pytests for different cases for it. The Pytest
I
I would appreciate it if you can check whether my code is correct and write 5 pytests for different cases for it.
The Pytest format is :
def test_unscrambleTuple_1:
assert unscambleTuple()==blablabla
def unscrambleTuples (list of tuples): Given a list of tuples that contain values of type string, int, and bool, unscramble the values to create a new list that turns each tuple from the list of tuples into a list with the values arranged by type as follows: [str, int, bool]. # declare empty list final list = [] # iterating through the list of tuples for tup in list of tuples: newList = [] for name in tup: if isinstance (name, str): newList.append (name) for num in tup: if type (num) ==int: newList.append (num) for item in tup: if isinstance (item, bool): newList.append(item) final list.append(newList) # returning the results return final list def unscrambleTuples (list of tuples): Given a list of tuples that contain values of type string, int, and bool, unscramble the values to create a new list that turns each tuple from the list of tuples into a list with the values arranged by type as follows: [str, int, bool]. # declare empty list final list = [] # iterating through the list of tuples for tup in list of tuples: newList = [] for name in tup: if isinstance (name, str): newList.append (name) for num in tup: if type (num) ==int: newList.append (num) for item in tup: if isinstance (item, bool): newList.append(item) final list.append(newList) # returning the results return final listStep 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