Skip to content

Python Variables

Variable Names:

  • Must start with a letter or an underscore
  • Can only contain alpha-numeric characters and underscores (A-z, 0-9, and _)
  • Case sensitive (Angle is not the ame as angle)

Variables Can Hold a Variety of Things

  • Text: angle = "Ninety degrees"
  • A number with a decimal point: angle = 90.0
  • A number without a decimal point: angle = 90
  • A collection: angle = ["Ninety", 90.0, 90]

Challenge

Which Variable Names Are Legal?

  • SayHello
  • _goodbye!
  • 2For1
  • another_variable
  • X
  • _42