Presentation is loading. Please wait.

Presentation is loading. Please wait.

For -G7 programing language Teacher / Shamsa Hassan Alhassouni.

Similar presentations


Presentation on theme: "For -G7 programing language Teacher / Shamsa Hassan Alhassouni."— Presentation transcript:

1 For -G7 programing language Teacher / Shamsa Hassan Alhassouni

2 Problem Solving Slow Down.. Pls Good Driver

3 What we will Learn today?
Understand IF - else statements Use If – else syntax in python Use if – elif – else syntax in python Add comments Practical tasks

4 IF – ELSE Statement

5 IF .. else Statement Using If else statement to give two or more possible choices that a program can follow IF else Syntax

6 Discover more through your practical activity
NO Task Completed Not Completed 1 Open the python edu 2 Select ‘the existing project named (grade7-1) 3 Click file > new > python file 4 Give the python file a name. (L7 - Name) 5 Type the following: 6 Run your program

7 Activity – color program
Create a variable choice to get the user input If the user selected the character – a Print (“you are aggressive”) Else Print (“ you are social) if we have a word we assign “ “ for the word i.e if choice == “yes” If we have a single character we assign ‘ ‘ i.e if choice == ‘a’ If we have a number it should be written without any quotes. Important note

8 IF – elif – else Statement

9 Start IF .. elif Statement Input traffic Color If we have more than one condition we will be using a keyword for else if (elif) Is it Red Yes No Stop Is it Yellow If else Statement Yes No Wait Is it Green Yes No Go Stop

10 How many cases do I have in the traffic light case ?

11 Complete the activity Modify your car speed program
If speed is more than 80 then the following message should appear “slow down.. Too fast” If speed is = 80 “good driver” If speed is lessthan 80 “you are so slow”

12 Activity – Modify color program
You are aggressive You are social You are respectable You are lovely

13 Answer– Modify color program

14 comments

15 Comments are added in the program to explain what the program does.
Syntax ## this program is called hello-world

16 How easy did find the today’s lesson in python?


Download ppt "For -G7 programing language Teacher / Shamsa Hassan Alhassouni."

Similar presentations


Ads by Google