Appearance
For Loop in Python
For Loop with Value
python
languages = ['Swift', 'Python', 'Go']
for lang in languages:
print(lang)
Output:
shell
Swift
Python
Go
For Loop with Index and Value
python
languages = ['Swift', 'Python', 'Go']
for idx, lang in enumerate(languages):
print(idx, lang)
Output
shell
0 Swift
1 Python
2 Go