What is the difference between parenthesis and brackets in Python

Tuples and lists

Both are arrays, but tuples are immutable. This means that once you define a tuple, you cannot add elements, pop, append, remove an element, etc. You need to create a new tuple out of the old one every time you make a change.

  • Tuples (1,2,3,4,5,6) are great for static definition. They are hashable, lean and unequivocal.
  • Lists [1,2,3,4,5,6] are great for computation. They are mutable and queueable.

Both are addressed with integers in brackets.

Whether it is a list or a tuple, addressing one element is the same.

create a tuple with y = (“a”,”b”,”c”) and do this;

y = ("a","b","c")
print (y[0])
for i in y:
    print (i)

For lists and tuples, know this too;

for i in range(0,len(y)):
    print (i,y,y[i])

Now redefine y as a list and try it again. Same results?

0 thoughts on “What is the difference between parenthesis and brackets in Python”

  1. Spot on with this write-up, I absolutely feel this amazing site needs much more attention. I’ll probably be returning to read through more, thanks for the information!

  2. I blog frequently and I genuinely appreciate your information. This article has truly peaked my interest.
    I am going to bookmark your website and keep checking for new information about once per week.
    I opted in for your RSS feed too.

  3. I loved as much as you’ll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get got an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case you shield this hike.

  4. Many thanks for making the effort to discuss this, I feel strongly about this and enjoy studying a great deal more on this matter. If possible, as you gain expertise, would you mind updating your webpage with a great deal more details? It’s extremely beneficial for me.

  5. I know of the fact that today, more and more people will be attracted to surveillance cameras and the field of images. However, as a photographer, it is important to first spend so much of your time deciding which model of video camera to buy along with moving store to store just so you could potentially buy the least expensive camera of the trademark you have decided to settle on. But it does not end just there. You also have to take into account whether you should buy a digital digital camera extended warranty. Thx for the good tips I gathered from your web site.

  6. Thanks for your information on this blog. One thing I would choose to say is the fact that purchasing electronic devices items from the Internet is not something new. The truth is, in the past ten years alone, the market for online electronic products has grown substantially. Today, you could find practically virtually any electronic device and product on the Internet, including cameras plus camcorders to computer pieces and gambling consoles.

  7. I do not even know how I ended up here, but I thought this post was great. I do not know who you are but certainly you are going to a famous blogger if you are not already 😉 Cheers!

  8. Thats what an angel is. Dust pressed into a diamond by the weight of this world. #TheOA needs your help. #SaveTheOA

  9. Its (in my humble opinion) near impossible to use a standard wrench to remove a bathroom faucet. A basin wrench or Ridgid Faucet & Sink Installer tool are
    How to fix a leaky sink faucet

  10. Hi there, I found your website by the use of Google even as searching for a similar matter, your
    website got here up, it seems to be great. I have bookmarked it in my google bookmarks.

    Hello there, just was alert to your blog via Google, and
    located that it is really informative. I am going to be careful
    for brussels. I will be grateful if you continue this in future.
    Many other folks will probably be benefited out of your writing.
    Cheers!

  11. This is really interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your fantastic post. Also, I have shared your website in my social networks!

  12. My programmer is trying to persuade me to move
    to .net from PHP. I have always disliked the idea because
    of the costs. But he is tryiong none the less. I have been using WordPress on a number of websites for about a year and
    am worried about switching to another platform. I have heard great things about blogengine.net.

    Is there a way I can import all my wordpress
    posts into it? Any kind of help would be greatly appreciated!

  13. Excellent website you have here but I was curious if you knew of any message boards that cover the same topics discussed here?

    I would really love to be a part of community where I
    can get feed-back from other knowledgeable people that share the same interest.
    If you have any recommendations, please let me know.

    Thanks!

  14. When I wake up in the morning I will have constant rumbles and gurgles in my .. Irritable Bowel Syndrome (IBS) What it feels like: Nausea, bloating, diarrhea,
    nausea in the morning

  15. Hello would you mind letting me know which hosting company you are utilizing?

    I have loaded your blog in 3 completely different web browsers and I
    must say this blog loads a lot faster then most. Can you suggest a good internet hosting provider at a
    honest price? Many thanks, I appreciate it!

Leave a Reply

Your email address will not be published. Required fields are marked *