Python tutorial part4

Python Tutorial part4

Hi, welcome to the Python Tutorial part4. In this tutorial session, In previous lesson you learned lists and inputs, today you will recognize the Tuple and Dictionary. If you have no knowledge about the Python programming language, I suggest you to read the previous parts.

Tuple

Firs thing that we learn in Python Tutorial part4 is Tuple. Tuple is a list that you are unable to change it values, it is just for display (storage of data without editing).

Type | a = (2, 3, 56, 43) | and you have created a tuple, you can call its values by typing | a[1] | or print it | print(a[0:2]) | unlike the lists you can not change any of values in tuples.

Dictionary

Dictionaries are one of the most useful things in Python and I decided to teach it in Python tutorial part4. Now let me explain you what is a Dictionary means in Python language, Dictionary is used to store data value in key (formal introduction). But what is that mean? Python’s Dictionary is so similar to regular English Dictionary. You have a word (key) and you have the interpret or translation of that word (value).

you might think that creating dictionary in python would be complicated, to your surprise its actually simple and fun to create. Type | person = { “name”: “Erick”, “age”: “23”, “job”: “front-end developer”} | in this dictionary NAME is value and ERICK is key, but how can you call the key? You should type | print(person[“name”])| then Erick would appear, please keep in mind that numbers could be value but you can not use them as key.

Share This Article on social media

Facebook
Twitter
LinkedIn

this blog is written by Erfan Samadi

 I hope you enjoyed! feel free to leave comment.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Erfan Samadi