Programming and Algorithms: Week 3

Banner

Selection

What are we doing this week?


This week we are going to look at the idea of SELECTION, how to give the users choice in out programs.
First we will look at the IF statements, and then a bit of Boolean logic, and finally the CASE statement.
Moving onto the Python side of things we will look at how to implement SELECTION in Python.

 
PseudoCode Python Python Logo

Powerpoint: 
Selection-IF


Powerpoint: Boolean Logic


Powerpoint:
Selection-CASE


Powerpoint: Selection


Powerpoint: Some Common Issues


Selection - The IF Statement


Selection - The CASE Statement
Total running time of videos is 50 minutes.

Sample Code:
SimpleIfStatement * AnotherSimpleIfStatement * AnotherSimpleIfStatementPrints * AnotherSimpleIfStatementPrintsShorter * IsOddOrEven * BiggerOfThree * BiggerOfThreeElif * MultiChoiceQuestion * GetGrade

Links
Python Docs: Control Flow Statements
https://docs.python.org/2/tutorial/controlflow.html

Learn Python the Hard Way: Else and If
http://learnpythonthehardway.org/book/ex30.html

Python for Beginners: If, Elif, Else Statements
http://www.pythonforbeginners.com/basics/python-if-elif-else-statement/

Lab #3
Lab #3 is all about checking if what you have learned in the episodes above all makes sense, and if you can use IF statements and the ELIF statement.


Reminder: Running Python Programs



Back

If you have any suggestions, corrections, or comments, please feel free to e-mail me at:
Damian.Gordon(a)dit.ie