mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Simplify sudoku.is_completed() using builtin all() (#1608)
* Simplify sudoku.is_completed() using builtin all() Simplify __sudoku.is_completed()__ using Python builtin function [__all()__](https://docs.python.org/3/library/functions.html#all). * fixup! Format Python code with psf/black push * Update sudoku.py * fixup! Format Python code with psf/black push * Old style exception -> new style for Python 3 * updating DIRECTORY.md * Update convex_hull.py * fixup! Format Python code with psf/black push * e.args[0] = "msg" * ValueError: could not convert string to float: 'pi' * Update convex_hull.py * fixup! Format Python code with psf/black push
This commit is contained in:
@ -28,7 +28,7 @@ class Point:
|
||||
Examples
|
||||
--------
|
||||
>>> Point(1, 2)
|
||||
(1, 2)
|
||||
(1.0, 2.0)
|
||||
>>> Point("1", "2")
|
||||
(1.0, 2.0)
|
||||
>>> Point(1, 2) > Point(0, 1)
|
||||
@ -41,7 +41,7 @@ class Point:
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ValueError: x and y must be both numeric types but got <class 'str'>, <class 'str'> instead
|
||||
"""
|
||||
"""
|
||||
|
||||
def __init__(self, x, y):
|
||||
if not (isinstance(x, Number) and isinstance(y, Number)):
|
||||
@ -200,8 +200,7 @@ def _validate_input(points):
|
||||
)
|
||||
elif not hasattr(points, "__iter__"):
|
||||
raise ValueError(
|
||||
"Expecting an iterable object "
|
||||
f"but got an non-iterable type {points}"
|
||||
"Expecting an iterable object " f"but got an non-iterable type {points}"
|
||||
)
|
||||
except TypeError as e:
|
||||
print("Expecting an iterable of type Point, list or tuple.")
|
||||
|
Reference in New Issue
Block a user