Skip to content
moe khan edited this page May 10, 2018 · 21 revisions

Welcome to the pythonclass wiki

Class Notes:

5/10/2018:

  1. review functions
  2. introduce classes / object oriented programming

Learning Python

  • Chapter 6 - Object Oriented Programming

5/08/2018:

  1. reviewed data types
  2. discussed dict type
  3. reviewed projects: blackjack & knights tour

Learning Python

  • Chapter 2 - Mapping Types - dictionaries

5/03/2018:

  1. reviewed topics to date
  2. discussed projects - select 1:
  • blackjack

    • use list to define deck
    • use random.shuffle to shuffle the deck
    • use pop() to deal a card
    • extra credit: betting / economy features
    • extra credit: double down, split features
  • knights tour

    • implement a brute force knights tour using python: https://en.wikipedia.org/wiki/Knight%27s_tour

5/01/2018:

  1. sequence types: strings, lists, tuples
  2. functions - an introduction
  3. import code from other files - libraries

Project: Roll the dice function

Learning Python

  • Chapter 2 - Immutable Sequences - Strings, Tuples
  • Chapter 2 - Mutable Sequences - Lists
  • Chapter 4 - Functions

4/26/2018:

  1. looping - while / break / continue / else
  2. importing existing code - random
  3. string concatenation
  4. Project: guess a number (looping + random + track # of tries)

Project: Guess a number

Psuedo-Code

randomly select a number between 1-100 Ask user to guess a number
Cast user input into an int
Check user's number against hard coded number
If too low, print a message saying so
If too high, print a message saying so
If correct, print a congratulations message, print number of tries, and end else, ask user to try again

Learning Python:

  • Chapter 3 - Looping

4/24/2018:

  1. Code in github review: goal: have a python file hosted in your github repo - synced with eclipse
  2. Build on boolean and boolean operators: decision making; If-then-else
  3. Casting: string to int
  4. input function
  5. Psuedo-code
  6. Project: guess a number (non-looping)

Project: Guess a number

Psuedo-Code

"Hard code" aka assign a number between 1-100 in your code
Ask user to guess a number
Cast user input into an int
Check user's number against hard coded number
If too low, print a message saying so
If too high, print a message saying so
If correct, print a congratulations message

Learning Python:

  • Chapter 3 - Conditional programming

4/19/2018:

  1. Being pythonic - import this

  2. Variables: numbers, strings; assignment operator, id operator, immutability

  3. Types: int (+ - //-floored quotient /-true %-remainder * **), float, string, bool-int equivalency (and, not), None; Dynamic typing; **fractions; **decimals

  4. Syntax – comments;

  5. Pushing your code to git hub

Learning Python:

  • Chapter 1 - Guidelines on how to write good code
  • Chapter 1 - The Python Culture
  • Chapter 2 - Everything is an object
  • Chapter 2 - Mutable or immutable? That is the question
  • Chapter 2 - Numbers

4/17/2018:

  1. Get python, eclipse + pydev, and github setup
  2. If you need help with above, please reach out to me – I am sure we can get you setup with someone in building to get you caught up.

BOOK: http://techbus.safaribooksonline.com/book/programming/python/9781783551712