For -G7 programing language Teacher / Shamsa Hassan Alhassouni
What we will Learn today? Understand Random concept Understand for Loops Understand Nested Loops
Random
Random Function Description Input() Print () Built in Function not require any import. Randint() Should be imported / loaded in the program using command import
Guess the number
Types of Loops/ Iteration Loop Type Description while loop Repeats a statement or a group of statements while a given condition is TRUE. It tests the condition before executing the loop body. for loop Executes a sequence of statements with a defined number of times and abbreviates the code that manages the loop variable. nested loops You can use one or more loops inside any another loop
For Loop
For Loop Let’s say that you want to print hello five times. How you will do it using python print function The above was will take time and to make repeating process much easier we will use for loop Variable Name
For Loop-Time Table Activity
Nested Loop
Loop in Loop / Nested Loops
Loop in Loop / Nested Loops
Code challenge Rock, Paper Scissors
How easy did find the today’s lesson in python?