Output finding
print('program-1')
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
print('program-2')
i =
while True:
if i%2 == 0:
break
print(i)
i += 2
print('program-3')
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
print('program-4')
i = 1
while False:
if i%2 == 0:
brea
print(i)
i+=2
print('program-5')
True = False
while True:
print(True)
break
print('program-6')
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
print('program-7')
x = "abcdef"
while i in x:
print(i)
print('program-8')
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
print('program-9')
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
print('program-10')
x = "abcdef"
i = "a"
while i in x:
x = x[:-1]
print(i, end = " ")
print('program-11')
x = "abcdef"
i = "a"
while i in x[1:]:
print(i, end = " ")
print('program-12')
x = 'abcd'
for i in range(x):
print(i)
print('program-13')
x = 'abcd'
for i in range(len(x)):
print(i)
print('program-14')
x = 123
for i in x:
print(i)
print('program-15')
for i in range(0):
print(i)
print('program-16')
for i in range(2.0):
print(i)
print('program-17')
for i in range(int(2.0)):
print(i)
print('program-18')
for i in 'abcd'[::-1]:
print (i)
print('program-19')
for i in '':
print (i)
print('program-20')
x = 2
for i in range(x):
x= 1
print (x)
print('program-21')
x = 2
for i in range(x):
x= 2
print(x)
print('program-22')
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
# Program - 23
Values = [11, 22, 33, 44]
for V in Values:
for NV in range (1, V%10):
print (NV, V)
# Program - 24
T1=(10,20,30,40,50)
T2 =(10,20,30,40,50)
T3 =(100,200,300)
cmp(‘Check1’,T1, T2)
cmp(‘Check2’,T2,T3)
cmp(‘Check3’,T3,T1)
# Program -25
T1=(10,20,30,40,50)
T2 =(10,20,30,40,50)
T3 =(100,200,300)
print(cmp(‘Check1’,T1, T2))
print(cmp(‘Check2’,T2,T3))
print(cmp(‘Check3’,T3,T1))
# Program - 26
a,b,c,d =9.2 , 2.0 , 4 , 21
print (a/5)
print(a//4)
print(a+b**c-2)
print(a%c)
# Program - 27
x =15
x= x+10
x=x-5
print(x)
# Program - 28
x = "abcdef"
i = "a"
while i in x:
print(i)
# Program - 29
x, y =2, 5
x, y =y, x+2
print(x, y)
# Program - 30
s='school2@com'
k=len(s)
m=" "
for i in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+'bb'
print(m)
Comments
Post a Comment