Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Review the following bad Loop code. The purpose of the code is to sum all the numbers in the numbers list; it functionally achieves this
Review the following "bad" Loop code. The purpose of the code is to sum all the numbers in the numbers list; it functionally achieves this goal but the code is problematic. What problems do you see with the code? What would you change and why?
Note: It is ok if your answers overlap with your classmates, but if possible, try to find new problems with the code that your classmates have not yet posted.
Example of a bad Loopnumbers
total
for in rangeLennumbers:
if :
total numbers i
elif :
total numbers i
elif :
total numbers i
elif ;
total numbers i
elif :
total numbers i
else:
printThis should never happen!"
printThe total is: total
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