Else with For Loop in Python

Else is executed only if For loop completes successfully.

for i in range(5):
    print(i)
    # if i==3:
    #     break
else:
    print("No answer")
    

Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes