is_valid_identifier(s) that returns True if s would be a legal Python variable name: non-empty, starts with a letter or underscore, and every subsequent character is a letter, digit, or underscore. Implement the checks manually (character by character), without calling str.isidentifier().s = '_my_var1'
True
Starts with underscore; rest are letters/digits/underscore.
s = '2fast'
False
Cannot start with a digit.
s = 'my-var'
False
Hyphen is not allowed inside an identifier.
Check s[0] with `.isalpha()` or equal to '_'.
Check every remaining character with `.isalnum()` or equal to '_'.