# loop control statement #countinue statement:it returns the control #to the beginning of the loop prints all letters #except 'g' and 'p' i = 0 a = 'codingmaayokp' while i < len(a): if a[i] == 'g' or a [i] == 'sp': i += 1 continue print ('current letter:', a[i]) i += 1
Output :-
current letter: c current letter: o current letter: d current letter: i current letter: n current letter: m current letter: a current letter: a current letter: y current letter: o current letter: k current letter: p
Study Makes Hero Tech
# loop control statement
#countinue statement:it returns the control
#to the beginning of the loop prints all letters
#except 'g' and 'p'
i = 0
a = 'codingmaayokp'
while i < len(a):
if a[i] == 'g' or a [i] == 'sp':
i += 1
continue
print ('current letter:', a[i])
i += 1
Output :-
current letter: c
current letter: o
current letter: d
current letter: i
current letter: n
current letter: m
current letter: a
current letter: a
current letter: y
current letter: o
current letter: k
current letter: p
#python #pythonprogramming #pythonlearning #pythondeveloper #pythonprogrammer #pythoncode #pythonstatus
1 year ago | [YT] | 1