Last active
May 22, 2020 05:36
-
-
Save slingam00/146ed1cdf6cf9741043f6151a255ea66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myList = [1, 2, 3, 4, 5] | |
# Iterating through a list | |
for i in myList: | |
print(i) # The elements in myList will each get printed on a new line | |
for i in range(len(myList)): | |
print(myList[i]) # Same thing, but the elements are getting index and then printed out | |
# Iterating through a string | |
myString = "hello" | |
for i in myString: | |
print(i) # each letter printed out on a seperate line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment