ch03
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class DriverException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
people = [('James', 17), ('Kirk', 9), ('Lars', 13), ('Robert', 8)]
|
||||
driver = None
|
||||
for person, age in people:
|
||||
if age >= 18:
|
||||
driver = (person, age)
|
||||
break
|
||||
|
||||
if driver is None:
|
||||
raise DriverException('Driver not found.')
|
||||
Reference in New Issue
Block a user