Python tuples and sets in under a minute: Discover how to create tuples, access their elements, create sets, add and remove elements easily. ????????
In Python, tuples are especially useful if you're trying to return data from a function in a predictable way.
Let's say I had a function called;
get_user_from_database(username)
that gets data from a database.
I can have that function return the data to the invoker as:
("Joey", 18, "programmer", "Australia", True)
This way, its basically a dictionary without the keys. It's also useful for mathematical operations!
Don't forget to like, subscribe, and leave a comment on what you want to learn next! ????
Join me in the PROGRAMMER'S REALM!
#Python #Programming #PythonTutorial #LearnToCode #CodingForBeginners #TheProgrammersRealm #sets #tuple
In Python, tuples are especially useful if you're trying to return data from a function in a predictable way.
Let's say I had a function called;
get_user_from_database(username)
that gets data from a database.
I can have that function return the data to the invoker as:
("Joey", 18, "programmer", "Australia", True)
This way, its basically a dictionary without the keys. It's also useful for mathematical operations!
Don't forget to like, subscribe, and leave a comment on what you want to learn next! ????
Join me in the PROGRAMMER'S REALM!
#Python #Programming #PythonTutorial #LearnToCode #CodingForBeginners #TheProgrammersRealm #sets #tuple
- Категория
- Программирование на python
- Теги
- python, programming, pythontutorial
Комментариев нет.