[PriP 1.1] Revision Tour-1 – Practical 1.1
Table of Contents
2. Give three examples of legal variable names and two examples of illegal variable names in Python. For the illegal variable names, explain why they are illegal. Do not use one-letter variable names.
Solution:
- Legal Names:
- my_variable
- nameList
- total_sum
- Illegal Names:
- 2nd_value (Variable names cannot start with a number)
- my-variable (Variable names cannot contain hyphens)