Function error with numbers and decimal point in parameter

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 write_countries_capitals_to_file(0123456789.txt):
def main():
    Calling functions.


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:

  1. The characters in variable names must be alphanumeric or the underscore (_) character.
  2. Variable names must be one word
  3. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *