Question: Given the following class and main function, fill in the output from each statement on the given line: class TrafficLight: def _ init _ (
Given the following class and main function, fill in the output from each statement on the given line: class TrafficLight: def initself initialcolor "green", carswaiting : self. color initialcolor self. carswaiting carswaiting First Ave: green yellow, def cyclecolor self : Second Ave: red green, if self. color "green": self. color "yellow" elif self. color "yellow": self. color "red" elif self. color "red" and self. carswaiting : self. color "green" def strself: return "Color: self. color Cars: strselfcarswaiting def main : firstave TrafficLight secondave TrafficLightred firstave. cyclecolor secondave cyclecolor print "Second Avenue: secondave Error secondave carswaiting secondave cyclecolor print "First Avenue:", firstave Error print "Second Avenue: secondave Error main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
