Python Python Basics Types and Branching Numeric

Why were apostrophes not needed when you ran the command: int(, or round(?

In the video, I noticed you did not have to add apostrophes to the syntax. Are numbers not apart of a string literal? Or does Python not see individual numbers as chunks?

adrian miranda
adrian miranda
12,656 Points

Not sure what you mean. Why don't you give an example of what you saw in the video, and then show what you thought it should have been.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 58,896 Points

As Python parses code it sees tokens (chunks of code) as either:

  • built-in keywords or functions,
  • user-defined objects and variables (object labels)
  • literal strings (bound by quotation marks)
  • numbers

Since objects and label names can not have a number as the first character, the int() and round() will determine they are operating on a number.

Post back if you need more help. Good luck!!!

Ah that makes sense! cool, thank you!