Skip to content

Instantly share code, notes, and snippets.

@Kwpolska
Created October 4, 2015 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kwpolska/e26916a9cfcb79dcbf1c to your computer and use it in GitHub Desktop.
Save Kwpolska/e26916a9cfcb79dcbf1c to your computer and use it in GitHub Desktop.
Calculator-based Python learning plan

Calculator-based Python learning plan

(Python 3: replace raw_input() with input())

Step 1

1st number: 7
2nd number: 3
Operation (+-*/%): +
7 + 3 = 10

done using raw_input() thrice, and an if-elif-elif-elif-elif-else tree

Step 2

Type an expression in format A # B (where # is an operator, one of +-*/%)
> 7 + 3
10

done using raw_input() once, str.split() and the same tree as above

Step 3

Optimize by using a dict of operators (import operator)

Step 4

Come up with other ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment