Lecture-3 Pagle
Lecture-3 Pagle
We don’t need everything in our program, that’s why different Libraries are made.
For e.g.
import math now i have some powers of math library
1. For loop
for <variable> in <sequence> :
2. While loop
/statements/
while <condition> :
/statements/
Egg jaampal
while i<11:
print(num*i)
Loop else statements
for <variable> in <sequence>: while <condition>:
statements statements
else : else :
statements statements
for i in range(1,6):
for j in range(1,6):
print(i*j,end=”___”)
print(“\n”)
Difference in == and is
a = ‘Harsh’
b= input(“Enter the name : “)
if(a==b): Cases :
print(“true”)
else 1. Strings are inputted.
print(“false”) 2. Very large integers.
3. Floating points & Complex Literals
if(a is b):
print(“true”)
else:
print(“false”)
Practice Time
1. Evaluate : 14 + 13 % 15
2. Write the command to print : E:\New Folder\list.txt
3. Which will give an error:
a. float(‘12’)
b. int(‘12’)
c. float(‘12.5’)
d. int(‘12.5’)
4. In a nested loop break statement breaks all the loops in one go?
Practice Time
1. Find the output : 2. Mark the mistakes :