mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-18 19:57:35 +00:00
change variable name from s to number_string as it is more descriptive
This commit is contained in:
parent
0b4271a5d7
commit
3faf2cd53e
@ -196,7 +196,7 @@ def classify_char(char: str) -> CharType | None:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def is_valid_number(s: str) -> bool:
|
def is_valid_number(number_string: str) -> bool:
|
||||||
"""
|
"""
|
||||||
This function checks if the input string represents a valid number.
|
This function checks if the input string represents a valid number.
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ def is_valid_number(s: str) -> bool:
|
|||||||
valid_final_states = {State.WHOLE, State.FRACTION, State.EXP_NUMBER}
|
valid_final_states = {State.WHOLE, State.FRACTION, State.EXP_NUMBER}
|
||||||
current_state = State.INITIAL
|
current_state = State.INITIAL
|
||||||
|
|
||||||
for char in s:
|
for char in number_string:
|
||||||
char_type = classify_char(char)
|
char_type = classify_char(char)
|
||||||
if char_type is None or char_type not in state_machine[current_state]:
|
if char_type is None or char_type not in state_machine[current_state]:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user