diff --git a/syntactic-sugar-python/README.md b/syntactic-sugar-python/README.md index 3808952bbd..9890415043 100644 --- a/syntactic-sugar-python/README.md +++ b/syntactic-sugar-python/README.md @@ -1,3 +1,3 @@ -# Syntactic Sugar in Python: Making Your Code Pythonic +# Syntactic Sugar: Why Python is Sweet and Pythonic -This folder provides the code examples for the Real Python tutorial [Syntactic Sugar in Python: Making Your Code Pythonic](https://realpython.com/python-syntactic-sugar/). +This folder provides the code examples for the Real Python tutorial [Syntactic Sugar: Why Python is Sweet and Pythonic](https://realpython.com/python-syntactic-sugar/). diff --git a/syntactic-sugar-python/circle.py b/syntactic-sugar-python/circle.py index 90baeceace..8cb9e94273 100644 --- a/syntactic-sugar-python/circle.py +++ b/syntactic-sugar-python/circle.py @@ -8,11 +8,11 @@ def __init__(self, radius): def area(self): return pi * self.radius**2 - def perimeter(self): + def circumference(self): return 2 * pi * self.radius circle = Circle(10) print(circle.radius) print(circle.area()) -print(circle.perimeter()) +print(circle.circumference()) diff --git a/syntactic-sugar-python/timing.py b/syntactic-sugar-python/timing.py index 0be2f7d75a..484ea8a4c3 100644 --- a/syntactic-sugar-python/timing.py +++ b/syntactic-sugar-python/timing.py @@ -5,9 +5,9 @@ def timer(func): @functools.wraps(func) def _timer(*args, **kwargs): - start = time.time() + start = time.perf_counter() result = func(*args, **kwargs) - end = time.time() + end = time.perf_counter() print(f"Execution time: {end - start:.4f} seconds") return result