lambdamusic
2/7/2013 - 9:27 PM

Python: Python: iteration, break and continue

Python: Python: iteration, break and continue

>>>word = "Pithon Phrasebook"
>>>string = ""
>>>for ch in word:
>>>    if ch == 'i':
>>>        string +='y'
>>>        continue
>>>    if ch == ' ':
>>>        break
>>>    string += ch
>>>print string
Python