For -G7 programing language Teacher / Shamsa Hassan Alhassouni
What we will Learn today? Understand Flow chart – Algorithm and Pseudocode Understand text based games Understand Loops
Flow Charts & PSEUDOCODES
Flow Chart Flow Chart : is a diagram that shows a process , made up of boxes representing steps , decisions, input and output
Flow Chart
Activity / 1 Complete the flow chart using the following words: OUTPUT Start Complete the flow chart using the following words: OUTPUT INPUT START STOP DECISION Output Stop
Response stored in variable Activity /2 ------------------- ---------------- Enter a number Response stored in variable --------------- Is the num > 0 “number is positive” “number is negative” Yes No Complete the flow chart using the following words: OUTPUT INPUT START STOP DECISION
Response stored in variable Activity /2 Enter a number Response stored in variable Decision Is the num > 0 “number is positive” “number is negative” Yes No Start Complete the flow chart using the following words: OUTPUT INPUT START STOP DECISION Output Input Output Output Stop
Algorithm Algorithm: is sequence of instructions that are followed to complete a task. Two ways to represent Algorithm: flow chart - pseudocode
Pseudocode Psedudocode: is a way to represent the flow chart. It is a simple way to describe set of instructions that doesn’t have syntax. In pseudocode, INPUT asks a question. Output prints a message on the screen.
Activity /3 Write down the Psedudocode of the following program:
Text Based Games
Text Based Games Text based games : games that uses characters instead of images and animations.
Loops
Iteration / Loops Iteration : is the process of repeating steps. Two ways for Iteration : Count –controlled Condition controlled
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. (L8 - loop) 5 Type the following: 6 Run your program and discuss the output 10 The program will not end – it will stuck because the
Discover more through your practical activity 6 change your program and discuss the output now 7 Write a loop that displays numbers 10 to 100 in steps of 5 8 Challenge: Write a program to allow the user to enter his password, if the password is wrong, he will have 3 tries.. But if a correct password is entered, the program should end.. 10
Password Program Code To stop the program if the correct password is entered
How easy did find the today’s lesson in python?