Digital Solutions

Python 3.X



console


recommended editor: IDLE (included in default python install)

  1. Input / Output
  2. Data Types
  3. Random Numbers
  4. Branching - If
  5. Branching - If Else

  6. SHORT CHALLENGE 1 - recreate this program

  7. Branching - And Or Not

  8. SHORT CHALLENGE 2 - recreate this program

  9. Branching - Elif

  10. Extension Exercises I

    PY_MC1.pdf | ANSWER SHEET.pdf - print and complete without laptop help

  11. Iteration - While Loops
  12. Iteration - For Loops

  13. SHORT CHALLENGE 3 - recreate this program
    SHORT CHALLENGE 4 - recreate this program

  14. Iteration - Nested Loops

  15. Extension Exercises II


    Extension Exercises III

  16. Lists

  17. PY_MC2.pdf | ANSWER SHEET.pdf - print and complete without laptop help

    SHORT CHALLENGE 5 - recreate this program


    1. Generate a Python script that performs the following behaviour when run:

      Username: joe
      invalid username
      Username: sue
      Password: 123
      invalid password
      Username: sue
      Password: abc
      access granted
    2. Generate a Python script that inputs a positive integer n, and for each number between n and 1, the script will count backwards to 1. For example:

      enter n: 4
      4
      3
      2
      1
      3
      2
      1
      2
      1
      1
    3. Monty Hall problem - simulate the Monty Hall gameshow using 3 doors, as shown in the following output:

      choose door 1, 2 or 3: 1
      door 3 is empty
      would you like to switch to door 2? N
      door 1 is empty
      choose door 1, 2 or 3: 1
      door 2 is empty
      would you like to switch to door 3? Y
      door 3 is prize
      choose door 1, 2 or 3: 3
      door 1 is empty
      would you like to switch to door 2? N
      door 3 is empty
    4. Let's Make a Deal gameshow [modified] - Five briefcases labelled A through E, randomly contain $1, $20, $300, $4000 and $50000 respectively. Implement your most eloquent and sophisticated solution to produce the following output:

      Version 1:
      choose briefcase A, B, C, D or E: C
      briefcase C contains $20
      
      Version 2:
      choose briefcase to hold ['A','B','C','D','E']: C
      choose briefcase to open from remaining ['A','B','D','E']: D
      briefcase D contains $1
      choose briefcase to open from remaining ['A','B','E']: A
      briefcase A contains $50000
      choose briefcase to open from remaining ['B','E']: E
      briefcase E contains $20
      choose briefcase to open from remaining ['B']: E
      invalid selection
      choose briefcase to open from remaining ['B']: B
      briefcase B contains $4000
      briefcase C contains $300
      


  18. Dictionaries
  19. String Manipulation
  20. Sets
  21. Tuples

  22. Extension Exercises IV


    Extension Exercises V

  23. Functions
  24. Recursion
  25. Importing Functions from Files
  26. Files R/W
  27. Exceptions
  28. OOP - Card Deck example
  29. OOP - Doc Types example
  30. OOP - Variable Scope
  31. OOP - Variable Scope
  32. OOP - Multiple Classes
  33. OOP - Autoteller Console

other interesting snippets:
  1. Trader Game Console
  2. Python with Access Database