You are on page 1of 2

# Q1:

count=20
for x in range(0,10):
count=count-1
if x==2:
break
print(count)

# Q2:
k=1
while k<5:
if k%7==0:
break
k=k+2
print(k)

#Q3:
my_list=["dog",24,'cat',12]
count=0
for element in my_list:
if element=='cat':
continue
count=count+1
print(count)

# Q4:
my_str="university"
count=0
for char in my_str:
if char=="i":
continue
else:
count=count+1
print(count)
# Q5:
my_str="university"
count=0
for char in my_str:
count=count+1
if char=="e":
break
print(count)

# Q6:
my_list=[6,5,7,2,3,5,7,8]
count=0
for number in my_list:
if number==5 or number==7:
continue
else:
count=count+number
print(count)

You might also like