Skip to main content

Variables

In Python, variables are defined with certain rules. 




Let's get started reading about them!! 

  • Don't create variable with a number
    • Eg: '12a'; #is wrong.
  • Don't define any variables with space, instead we can define with intend mark.
    • Eg: new word = Hello ; #is wrong
    • new_word = Hello ; #is correct
  • Don't create any variable contain any of these symbols:

    :'",<>/?|\!@#%^&*~-+
  • it's considered best practice (PEP8) that names are lowercase with underscores

  • avoid using Python built-in keywords
    • built-in keywords like list and str
  • avoid using the single characters l (lowercase letter el), O (uppercase letter oh) and I (uppercase letter eye) as they can be confused with 1 and 0

Comments