Feb-24-2018, 07:33 AM
Hello Pythonians,
What I understood about the keyword "pass", is that it works exactly like the keyword "continue", except it implements the remaining part of the "clause" that it happens to be in.
In this case, let's say we have the following example:
The output of this code will be:
Thanks,
What I understood about the keyword "pass", is that it works exactly like the keyword "continue", except it implements the remaining part of the "clause" that it happens to be in.
In this case, let's say we have the following example:
letter_num = 1 for letter in "Howdy!": if letter == "w": pass print("Encounterd w, not processed ") print('Letter ', letter_num, ' is ', letter) letter_num += 1
The output of this code will be:
Letter 1 is H Letter 2 is o Encounterd w, not processed Letter 3 is w Letter 4 is d Letter 5 is y Letter 6 is !So I do not see what "pass" has done!! the fourth line in the output shouldn't appear. In other word, even if we remove "pass" the output remains the same.
Thanks,