Learn To Program
Increase Your Knowlegde and Build Your Skill!
Pages
(Move to ...)
Home
Me
▼
Sunday, December 19, 2010
Python For Loop
For loop in Python is embed with list, and it's similar to foreach in PHP. This for loop will iterate to all elements in the data structure:
>> cities = ["jakarta", "manila", "sydney"] // list
>> for value in cities:
>> print value
This code will print out all chars in the string text:
>> for i in "Holla World":
>> print i
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment