explain it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

explain it

l = "upadhyay raghvendra" for letter in l: if (letter == 'p' or letter == 'g'): continue; else: print(letter)

17th Oct 2018, 2:58 PM
raghvendra upadhyay
raghvendra upadhyay - avatar
2 Answers
+ 3
it prints all letters, except if it is a 'p' or a 'g'. Those are skipped.
17th Oct 2018, 3:04 PM
Paul
Paul - avatar
+ 1
In python, continue mean you're skipping something... So as your condition is saying if string's letters match with p or g letter it'll skip those letter...And then it will show rest of the letters.
17th Oct 2018, 3:11 PM
Ahanaf Tahmid
Ahanaf Tahmid - avatar