Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedI

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 list

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

Step: 3

blur-text-image

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions