<jupyter_start><jupyter_text>Control Flow and Loops  Control FlowIf, Elif, Else statements> Expression in if statement can be complex or simple but it always result in boolean output True or False<jupyter_code>ipl_season = 2

if ipl_season ==  1:
    print("winner is rajasthan royal")
elif ipl_season == 2:
    print("winner is deccan charges")
elif ipl_season == 3:
    print("winner is Chennai Superkings")
else:
    print("winner after season 3 is not known")
#if else statement for non boolean statement
error = 3
if error:
    print(f"There are {error} errors.")
else:
    print("There are no mistakes")
error = 0
if error:
    print(f"There are {error} errors.")
else:
    print("There are no mistakes")<jupyter_output>There are no mistakes<jupyter_text>**Below are the most of the built-in objects that are considered False in python:**1. Constants defined to be false: None and False.2. Zero of any numeric type: 0, 0.0, 0j, Decimal(0), Fraction(0, 1).3. Empty sequences and collections: '"", (), [], {}, set(), range(0)  Loops1. while loop2. for loop  while Loop :-<jupyter_code>i=1  #assigning the value
while i<10:   #condition
    print(i)
    i = i+1   #increment or decrement<jupyter_output>1
2
3
4
5
6
7
8
9<jupyter_text>nested while loop :-<jupyter_code>i=1
j=1
while i<=5:
    print("Vidya", end="")
    j=1
    while j<=4:
        print(" sagar", end="")
        j=j+1
    i=i+1
    print()<jupyter_output>Vidya sagar sagar sagar sagar
Vidya sagar sagar sagar sagar
Vidya sagar sagar sagar sagar
Vidya sagar sagar sagar sagar
Vidya sagar sagar sagar sagar<jupyter_text>for Loop :-for loop works with iterable like sequence type tuple, list or strings and non-sequence type dictionary and files.<jupyter_code>x = ['Vidya', 32, 'Sagar', 65]
for i in x:
    print(i)
#for loop to create list object
cities = ['mumbai', 'delhi', 'london', 'newyork']
capitalized_cities = []
for city in cities:
    capitalized_cities.append(city.title())
print(capitalized_cities)
x = range(4)
x<jupyter_output><empty_output><jupyter_text>you can view value in range object by converting them into list or iterating through it using for loop.<jupyter_code>x = list(range(4))
x
for i in x:
    print(i)
cities = ['mumbai', 'delhi', 'london', 'newyork']
for index in range(len(cities)):
    cities[index] = cities[index].title()
print(cities)<jupyter_output>['Mumbai', 'Delhi', 'London', 'Newyork']<jupyter_text>Print number between 1 and 21 not divisible by 5<jupyter_code>for i in range(1,21):
    if i%5 != 0:   
        print(i)
#for loops with dictionary
mydict = {'name': 'sagar', 
          'age': 30, 
          'income':10000, 
          'home': 3}

for k,d in mydict.items():
    print(f"Hi {k}, and it is {d}")<jupyter_output>Hi name, and it is sagar
Hi age, and it is 30
Hi income, and it is 10000
Hi home, and it is 3<jupyter_text>Break Continue and Pass  1. Break :- Break is use to jump out of loop<jupyter_code>#lets take an example for clear understanding

available_choco = 10
x = int(input("How many choco you want?"))

i = 1
while i <= x:
    if i>available_choco:
        print("Out of Stock")
        break
    print("Choco")
    i += 1
print("end")<jupyter_output>How many choco you want? 10<jupyter_text>2. Continue :- continue use to skip the iteration and keep continue the loop<jupyter_code>#suppose we need to print  1 to 20 but not the one which are divisible by 3
for i in range(1,21):
    if i%3 == 0:
        continue
    print(i)
print("end")<jupyter_output>1
2
4
5
7
8
10
11
13
14
16
17
19
20
end<jupyter_text>Difference between break and continue<jupyter_code>#continue 
for i in range(5):
    if i==3:
        continue
    print("Hello", i)
#break
for i in range(5):
    if i ==3:
        break
    print("Hello", i)<jupyter_output>Hello 0
Hello 1
Hello 2<jupyter_text>So that means in case of break it simply comes out of loop where as in case of continue just skip condition and move to next.  3. Pass :-pass simply means there is no code simply ignore it<jupyter_code># suppose we don't want to print the odd numbers
for i in range(1,21):
    if(i%2!=0):
        pass
    else:
        print(i)
print("end")<jupyter_output>2
4
6
8
10
12
14
16
18
20
end
{'fraction_non_alphanumeric': 0.10962502985431097, 'fraction_numerical': 0.03319799379030332, 'mean_word_length': 3.8584686774941996, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '552782', 'license': 'CC0-1.0', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1483, 'n_words': 544, 'path': 'controlflow.ipynb', 'repo_name': 'vidyasagarbhargava/LearnPython', 'size': '4187'}