Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 4a (2 points): Finding Edge Cases I This program is a partially correct solution to the winning streak problem from a previous lab. Given
Question 4a (2 points): Finding Edge Cases I This program is a partially 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 # Modify the value of this variable so that winningstreakBad produces incorrect PROBLEM_INPUT1'' # Do not modify the code below this line def winningStreakBad(s): if type(s) not in (tuple, list, str): return 0 if len(s)0: returne wins 1 maxwins = 1 for i in range(1en(s)): if s[i] s[14]: == wins 1 else: wins 1 if wins maxwins: maxwins wins return maxwins ## This is what the autograder will see winningStreakBad(PROBLEM INPUT1) Question 4b (2 points): Finding Edge Cases ll The code below tries to solve the linear system 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.) # Modify these values so that solveLinearBad does not produce correct results # Do not modify the code below this line def solvelinearBad(a, b, c, d): for i in [a, b, c, d]: if type(i) not in (int, float): return False x(b d) / (c - a) return x ## This is what the autograder will see : solveLinearBad(A, B, C, D) # Hidden test cell for 4b
Step 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