Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 808
  • Last Modified:

php object array, python tuple list dictionary

python has tuple, list, dictionary

php has object and array

I learned php but
I am trying to learn python but I do not understand these variable types


Php is used for websites.
What is python used for?
'Dragon naturally speaking'?
Translators?
0
rgb192
Asked:
rgb192
2 Solutions
 
Walter RitzelSenior Software EngineerCommented:
Python can be used for web, windows/linux/macOS scripts, etc... Python is very popular in the data science domain, bioinformatics. It is also used as scripting language for many environments, as Oracle SOA, Websphere, etc...

I strongly advise you to visit: python.org for more detailed information.

Now, in respect to your specific doubt, let me try to clarify: tuples, list and dictionaries are specific types of array. In fact, when comparing to PHP, all those types map against the array type in PHP.

In Python:
Dictionary --> saves pairs of key, value. Keys are unique.
dict = {} #this is how you initialize a dictionary.
key = 'a'
value='tst'
dict[key] = value #this is how you add a key,value to a dictionary

Open in new window


Lists --> this tutorial is good: http://www.tutorialspoint.com/python/python_lists.htm

Tuples --> http://www.tutorialspoint.com/python/python_tuples.htm

From Python website: https://docs.python.org/2/tutorial/datastructures.html

Hope this helps.
0
 
rgb192Author Commented:
thanks for python explanations and links
Best answer was tuples,lists, dictionary are a specific type of array
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now