Question: How to use Python to create while function to pytest code of second picture def addListElements(alist): -write a funciton that takes in a list (alist)

def addListElements(alist): -write a funciton that takes in a list (alist) of items and returns a tuple of length 2. -The @th element of this tuple should be a sum of all the ints and floats in alist, and the 1st element of the tuple should be concatenation of all the strings from alist -Other types (e.g., bool) should be ignored -If there are no ints or floats, the sum should be zero. If there are no strings, the second element of the tuple should be an empty string. ***Hint: think of creating a variables that you initialize to the default values (and ), which will, for example, help you keep track of the running sum. ** return "stub" assert charWordList([""], ".") == [] def test_charWordList_4(): assert charWordList(["", 8, True, "groot", "grout"], True) == None #################### from labo3 import addListElements # Test cases for addListElements: def test_addListElements_1(): assert addListElements(["I") 13, "Love", 12, "Shrek", 11]) == (36, "ILoveShrek") def test_addListElements_2(): assert addListElements(["", True, "groot", ""]) == (0,"groot") def test_addListElements_3(): assert addListElements([]) == (0,"") def test_addListElements_40): assert addListElements([ "What", True, "Are", "Those?"]) == (0,"WhatAreThose?") e w
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
