I am new to Python any help would be appreciated.
There is a red squiggly line underneath the parameter.(“0123456789.txt”)
This is my function.
def main(): """ Calling functions. """ write_countries_capitals_to_file("0123456789.txt")
I’m confused as to why i’m getting an error. I know if I place a letter in front of the numbers the numbers get grayed out. But I need it to work how it is displayed.
Thanks for the help
This is just an issue with variable naming. In Python, variables have to follow the following rules:
- The characters in variable names must be alphanumeric or the underscore (
- Variable names must be one word
- Variable names cannot start with a number
Parameter naming rules are the same as variable names (since parameters are essentially local variables). Since the name
1234567890.txt has a character (
.) which which is not alphanumeric and is not the underscore character (Rule 1), and the variable name starts with a number (Rule 3), then the variable name is invalid.