Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python Lesson 2.

Similar presentations


Presentation on theme: "Python Lesson 2."— Presentation transcript:

1 Python Lesson 2

2 Starter Start Python and create a program which will ask for the user’s name and current age and then will say Hello and will display their age on their next birthday. Possible Solution:

3 Objective of the lesson
Write simple programs using Python. All of you will: Use If statements to make a decision. Most of you will: Use more complex If statements including “elif”. Some of you will: Create If statements within other If statements.

4 Homework Everybody should complete Tasks 1 and 2 to find the errors in the program and complete the crossword. Some of you may also want to get the extra marks by completing the extension activity. This homework is due in next lesson. Make sure you have written your homework clearly in your planner.

5 If Statements What will this code do?
## is used to create comments which are ignored by Python but make the code easier to understand. If Statements What will this code do? if is used to decide if an action is going to be followed. It ends with a : symbol. Indents are very important as this tells Python where the different sections start and end. else is used to describe what will happen if the first condition has not been met.

6 More If Statements if condition: elif condition: else: Statement
if is used to decide if an action is going to be followed. elif stands for “else if” where you can test another condition. else is used to tell Python what to do if it hasn’t met any other conditions.

7 Try these out… Follow the instructions on the sheet to recap If statements. Remember to save them all with a suitable name followed by .py


Download ppt "Python Lesson 2."

Similar presentations


Ads by Google