Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4a (2 points): Finding Edge Cases l This program is a partally correct solution to the winning streak problem from a previous lab. Given

image text in transcribed

Question 4a (2 points): Finding Edge Cases l This program is a partally correct solution to the winning streak problem from a previous lab. Given a string, list, or tuple as input, find the longest winning streak. This solution contains an error. Find a test case that returns an incorrect value, or raises an error. Do not modify or try to correct the code for this question, simply find a problematic input for the function n [ ]: # Modify the value of this variable so that winningstreakBad produces incorrect output PROBLEM INPuri # Do not modify the code below this line def winningStreakBad(s): if type(s) not in (tuple, list, str): return 0 if len()0: return 0 wins1 maxwins1 for i in range(len(s)) if s(ii-1]: wins+1 else: wins1 if wins zaxwins: maxwins- wins return maxwins n [ ] This is what the autograder will see: winningStreakBad ( PROBLEM INPUT1) n [ ]: | # Hidden test cell for 4a Question 4b (2 points): Finding Edge Cases lI The code below tries to solve the linear system: ax + b = cx + d Find an input (A, B, C, D) that produces incorrect results. For the purposes of this question, False is considered a correst result for non-numeric inputs (strings, lists, etc.) n [ ]: # Modify these values so that 801veLinearBad doe8 not produce correct results A-1 B 2 D-4 # Do not modify the code below this line def solveLinearBad(a, , c, d): for i in [a, b, c, d] if type(i) not in (int, float): return False return x n [ ] This is what the autograder will see: solveLinearBad(A, B, C, D)

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

Students also viewed these Databases questions