My task is to write a program that asks the user to enter 5 names which it stores in a list. Next, it picks one of these names at random and declares that person as the winn
This is taken from the Python docs:
Identifiers (also referred to as names) are described by the following lexical definitions:
identifier ::= (letter|"_") (letter | digit | "_")*
letter ::= lowercase | uppercase
lowercase ::= "a"..."z"
uppercase ::= "A"..."Z"
digit ::= "0"..."9"
Identifiers are unlimited in length. Case is significant.
That should explain how to name your variables.
Just adding 1 more scenario which may give the same error:
If you try to assign values to multiple variables, then also you will receive same error. For e.g.
In C (and many other languages), this is possible:
int a=2, b=3;
In Python:
a=2, b=5
will give error:
can't assign to literal
EDIT:
As per Arne's comment below, you can do this in Python for single line assignments in a slightly different way:
a, b = 2, 5