2020-04-06 14:49:56 -04:00
---
id: 5e7b9f070b6c005b0e76f05e
2020-04-21 23:37:02 -05:00
title: 'Iterations: Loop Idioms'
2020-04-06 14:49:56 -04:00
challengeType: 11
videoId: AelGAcoMXbI
---
## Description
2020-08-04 20:56:41 +01:00
2020-04-06 14:49:56 -04:00
< section id = 'description' >
< / section >
## Tests
2020-08-04 20:56:41 +01:00
2020-04-06 14:49:56 -04:00
< section id = 'tests' >
2020-08-04 20:56:41 +01:00
````yml
2020-04-06 14:49:56 -04:00
question:
2020-05-31 13:57:09 +01:00
text: |
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?:
```python
smallest = None
print("Before:", smallest)
for itervar in [3, 41, 12, 9, 74, 15]:
if smallest is None or itervar < smallest:
smallest = itervar
break
print("Loop:", itervar, smallest)
print("Smallest:", smallest)
```
2020-04-06 14:49:56 -04:00
answers:
2020-05-31 13:57:09 +01:00
- |
2020-08-04 20:56:41 +01:00
3
2020-05-31 13:57:09 +01:00
- |
2020-08-04 20:56:41 +01:00
4
2020-05-31 13:57:09 +01:00
- |
2020-08-04 20:56:41 +01:00
6
2020-05-31 13:57:09 +01:00
- |
2020-08-04 20:56:41 +01:00
7
2020-04-06 14:49:56 -04:00
solution: 3
2020-08-04 20:56:41 +01:00
````
2020-04-06 14:49:56 -04:00
< / section >