Skip to content

Chapter 2: Some Basics

  • Triple quoted strings can span multiple lines
    • print("""This message will span several lines of the text.""")
      • Output:
        • This message will span several lines of the text.

Variable Names and Keywords

  • Never can contain spaces
  • Must begin with a letter

Statements and Expressions

  • len() is a built-in Python function that returns the number of characters in a string.

Operators and Operands

  • Modulo example
    • total_secs = 7684 hours = total_secs // 3600 secs_still_remaining = total_secs % 3600 minutes = secs_still_remaining // 60 secs_finally_remaining = secs_still_remaining % 60