Last active
March 11, 2021 04:55
-
-
Save studiawan/6546416 to your computer and use it in GitHub Desktop.
Python tuple declaration, initialization, and how to access
This file contains hidden or 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
# declaration without brackets | |
# elements are separated with comma | |
address = 'localhost', 80, 21 | |
# declaration with brackets | |
server_address = ('localhost', 5000) | |
# access by index | |
print(server_address[0]) | |
# access by iteration | |
for value in server_address: | |
print(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment