Test on MacBook Air (11-inch, Early 2015) 1.6 GHz Intel Core i5
List: List Time used: 7.607762999999999
import time
start = time.clock()
a = range(10000000)
b = range(10000000)
# exceptions.py | |
class UserException(Exception): | |
... | |
class UserNotFoundError(UserException): | |
def __init__(self): | |
self.status_code = 404 | |
self.detail = "User Not Found" |
def decorator_factory(argument): | |
def decorator(function): | |
def wrapper(*args, **kwargs): | |
something_with_argument(argument) | |
result = function(*args, **kwargs) | |
return result | |
return wrapper | |
return decorator |
Write another program that prompts for a list of numbers | |
as above and at the end prints out both the maximum and minimum of | |
the numbers instead of the average. | |
largest = None | |
smallest = None | |
count = 0 | |
total = 0 | |
while True: | |
try: |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.