mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
clean of unnecessary checks, imports, calls (#7993)
This commit is contained in:
@ -33,10 +33,9 @@ def fizz_buzz(number: int, iterations: int) -> str:
|
||||
...
|
||||
ValueError: iterations must be defined as integers
|
||||
"""
|
||||
|
||||
if not type(iterations) == int:
|
||||
if not isinstance(iterations, int):
|
||||
raise ValueError("iterations must be defined as integers")
|
||||
if not type(number) == int or not number >= 1:
|
||||
if not isinstance(number, int) or not number >= 1:
|
||||
raise ValueError(
|
||||
"""starting number must be
|
||||
and integer and be more than 0"""
|
||||
|
@ -62,8 +62,7 @@ def max_sub_array(nums: list[int]) -> int:
|
||||
current = 0
|
||||
for i in nums:
|
||||
current += i
|
||||
if current < 0:
|
||||
current = 0
|
||||
current = max(current, 0)
|
||||
best = max(best, current)
|
||||
return best
|
||||
|
||||
|
Reference in New Issue
Block a user