Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Latest commit

 

History

History

core_lesson2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Lesson 2 - The Basic Elements

Ch3 Running Python

  • Several ways to use the python interpreter
    • Interactively
      • Quick testing
      • Exiting
        • exit(), quit(), or ctrl + D
    • Run the code
      • For larger chunks of code
      • python filename.py or python3 filename.py
    • Using an IDE
      • For large projects

Ch4 Objects

  • Every entity is an object
    • Every object has
      • A type
      • Some value
  • Basic data types
    • Numbers
      • int, float, complex
    • Boolean
      • bool
    • String
      • str
  • Use type() to check the type of the object

Ch5 Operators and Expressions

  • Arithmetic operators
    • Addition +
    • Subtraction -
    • Multiplication *
    • Division /
    • Floor division //
    • Modulo %
    • Exponential **
  • Operator precedence
    • (), **, * // / %, + -
  • Overloaded operators
    • Concatenation +
    • Repeat however many times *

Ch6-7 Variables

  • Variables is a name or label that points to an object instance in memory
  • Assignment statement
    • variable_name = value
  • Different variables can point to the same object
  • Expressions
    • Produce a value
  • Statements
    • Instruction that a computer can execute
    • May not produce a value
  • Keywords
    • ..., nonlocal, ...
  • Conventions
    • Consists of letters, digits, or underscores
    • Must start with a letter or an underscore
    • Cannot be a reserved keyword
    • Use lowercase + underscores