fa
Feedback

فریب کلاهبرداران را نخورید! تل‌متریو این کانال‌ها را شناسایی و برچسب‌گذاری می‌کند 👉 برای مشاهده برچسب، اشتراک تهیه کنید

Free Python Course

Free Python Course

رفتن به کانال در Telegram
5 967
مشترکین
اطلاعاتی وجود ندارد24 ساعت
-357 روز
-22530 روز
آرشیو پست ها
WHILE LOOP FLOWCHART
WHILE LOOP FLOWCHART

WHILE LOOP while loop is used to run a block code until a certain condition is met. Syntax of while loop :
WHILE LOOP while loop is used to run a block code until a certain condition is met. Syntax of while loop :

EXAMPLE 3 : The range() function defaults to increment the sequence by 1, however it is possible to specify the increment val
EXAMPLE 3 : The range() function defaults to increment the sequence by 1, however it is possible to specify the increment value by adding a third parameter: range(2, 30, 3):

EXAMPLE 2 : The range() function defaults to 0 as a starting value, however it is possible to specify the starting value by a
EXAMPLE 2 : The range() function defaults to 0 as a starting value, however it is possible to specify the starting value by adding a parameter: range(2, 6), which means values from 2 to 6 (but not including 6):

EXAMPLE 1
EXAMPLE 1

RANGE FUNCTION IN FOR LOOP The Python range() function returns a sequence of numbers, in a given range. The most common use of it is to iterate sequence on a sequence of numbers using Python loops.

USING FOR LOOP WITH SET thisset = {"Rushi", "Sumit", "Tamrej"} for x in thisset: print(x) Output: Rushi Sumit Tamrej

ACCESS DICTIONARY VALUES USING FOR LOOP thisdict = { "Name": "Rushi", "Class": "10th", "Status": "Programmer" } for x in thisdict: print(thisdict[x]) Output: Rushi 11th Programmer

USING FOR LOOP WITH DICTIONARY thisdict = { "Name": "Rushi", "Class": "10th", "Status": "Programmer" } for x in thisdict: print(x) Output: Name Class Status

USING FOR LOOP WITH TUPLE thistuple = ("apple", "banana", "cherry") for x in thistuple: print(x) Output: apple banana cherry

USING FOR LOOP WITH TUPLE

LOOPING THROUGH A STRING Even strings are iterable objects, they contain a sequence of characters: for x in "Rushi": print(x) Output: R u s h i

Example : data = ["Rushi", "Atharva", "Kartik"] for x in data: print(x) Output: Rushi Atharva Kartik

FOR LOOP A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string). With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc.

TYPES OF LOOP IN PYTHON There are two main types of loops in Python : 1. for loop 2. while loop

WHAT IS LOOP ? In Python, a loop is a way to repeatedly execute a block of code.

Tommarow We Will Start Chapter 6th : LOOPS IN PYTHON

NESTED IF ELSE EXAMPLE :
NESTED IF ELSE EXAMPLE :

NESTED IF ELSE We can also use an if statement inside of an if statement. This is known as a nested if statement.
NESTED IF ELSE We can also use an if statement inside of an if statement. This is known as a nested if statement.

IF, ELIF & ELSE EXAMPLE : number = 0 if number > 0: print("Positive number") elif number == 0: print('Zero') else: print('Negative number') print('This statement is always executed') Output: Zero This statement is always executed