This was the question in the Python for everybody(Scientific computing with python):
Q)Below is code to find the smallest value from a list of values. One line has an error that will cause the code to not work as expected. Which line is it?:
smallest = None
for itervar in [3, 41, 12, 9, 74, 15]:
if smallest is None or itervar < smallest:
smallest = itervar
print("Loop:", itervar, smallest)
My doubt is which line would cause and error and what would it cause the code to not work?