""" # 3.
Iterative statement (for,while) /Range
"""
""" for loop:
# repeatedly execute a block of code
# syntax :
for item in sequence :
code
"""
""" 1st Example """
# ls=[20,30,4,50,53,15]
# for item in ls:
# # print("item value is",item)
# if item % 2 ==0:
# print(f"item value {item} is even number") # for all
number item value {item} is even number
# else :
# print(f"item value {item} is odd number")
""" 2nd Example """
# ages = (19,2,12,38,31,50)
# for i in ages:
# if i>=18:
# print(f"age is {i} eligible for vote")
# else:
# print(f"age is {i} not eligible for vote")
""" 3rd Example """
# string ="ETL automation"
# for i in string:
# if i.lower() in ('a','e','i','o','u'):
# print(f"the {i} has vowels")
# else :
# print(f"the {i} not has vowels")
""" 4th Example """
# for i in range(10) :
# print(i)
""" Range
"""
""" characteristics of Range:
# start,stop,step
# start(o to stop-1)
# stop(start to stop-1)
# step(start to stop-1 with step of step)
# memory efficiency:large ranges """
""" 1st Example """
# first type(only show how many numbers
# a=range(10)
# print(a,type(a),id(a))
# second type(print all one numbers
# for i in a:
# print(i)
""" 2nd Example """
# for i in range(10):
# print("i value is",i)
# for j in range(1,10,):
# print("j value is",j)
# for k in range(1,100,10):
# print("k values is",k)
""" 3rd Example """
# number=int(input("Enter the numbers: "))
# col_sum = 0
# for i in range(number):
# sum += i # sum = sum+i
# print(f"sum of 0 to {number-1} number is :",col_sum)
""" 4th Example """
# number=int(input("Enter the number: "))
# even_sum = 0
# odd_sum = 0
# for i in range(number):
# if i % 2 == 0:
# even_sum += i
# else :
# odd_sum += i
# print(f"Even number sum ",even_sum)
# print(f"Odd number sum ",odd_sum)
""" 5th Example(dict iterative) """
# d={1:'prem',2:'rahul',3:'jann'}
# print("d is ",d)
# print("keys",d.keys())
# print("values",d.values())
# print("items",d.items())
# for i in d.keys():
# print("keys is",i)
# for z in d:
# print(z)
# for j in d.values():
# print("values is",j)
# for k in d.items():
# print("items is",k)
""" 6th Example(memory efficiency b/n range,list,tuple)
"""
# a=range(1,4)
# b=(1,2,3)
# c=[1,2,3]
# print("size of a",a.__sizeof__()) # 48
# print("size of b",b.__sizeof__()) # 48
# print("size of c",c.__sizeof__()) # 72
""" while loop:
# if it condition true (inside loop is executed)
# if it condition false ( loop is terminated and go to next
step)
# syntax :
while condition or/and condition2:
code
"""
""" 1st Example """
# a=10
# b=10
# while a==b:
# print("Hello world") # infinite
""" 2nd Example """
# num=10
# while num>=0:
# print(num) # 10 -0 (it will all
numbers)
# num=num-1