Lists & Tuples in Python (How to Use Them Effectively?) #15

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 89

  • @programizstudios
    @programizstudios  2 ปีที่แล้ว +6

    Learn Python with a more hands-on experience with Programiz PRO.
    🚀 Get 60% off on our Lifetime Plan this Black Friday-pay once for skills that last forever. Don’t miss out, it’s a limited-time offer!
    👉 Grab your discount now: bit.ly/blkfriday-py-24-yt

  • @rashedzaman990
    @rashedzaman990 ปีที่แล้ว +2

    I have been lately watching a lot of videos but Punit, he truly stands out. His teaching method is awesome. Those who are struggling to understand Decorators in Python, I will strongly recommend them to watch Punit’s video on Decorators in Python.

  • @saiful_khalid
    @saiful_khalid 3 ปีที่แล้ว +22

    We are so lucky that these videos are free. Thank you Programiz

  • @घटिया_कानून
    @घटिया_कानून ปีที่แล้ว +1

    "guruji"
    clearest,easiest,simplest
    Its great asset for students
    to learn python

  • @pandathegeneral2426
    @pandathegeneral2426 3 ปีที่แล้ว +5

    Im getting better at coding because of this channel THANK YOU SO MUCH im going to push myself until i become a game dev!

  • @hadeerrashad5486
    @hadeerrashad5486 2 ปีที่แล้ว

    This is the BEST video I have ever watched that explained the concepts perfectly.

  • @kawaiikina3618
    @kawaiikina3618 2 ปีที่แล้ว +2

    Thank you Punit and Programiz team's effort! Your videos are the best tutorials I have come across which provide clear explanation on the code structures and are sooooo easy to follow!!

  • @danielakoyleek3757
    @danielakoyleek3757 2 ปีที่แล้ว

    My guy! explicit teacher. Cheers from South Sudan❤!!!

  • @tharuna6205
    @tharuna6205 2 ปีที่แล้ว +1

    Underrated channel

  • @beastashwin1923
    @beastashwin1923 3 ปีที่แล้ว +4

    This video is really helpful, short and to the point! Thanks a lot ❤️

  • @duongminh1972able
    @duongminh1972able 3 ปีที่แล้ว +2

    You present in a clear way. Thank you

  • @theonlymaster9374
    @theonlymaster9374 2 ปีที่แล้ว +2

    1. True
    2. ['Hello', 'Hi', 'java', True]
    Traceback (most recent call last):
    File "", line 7, in
    TypeError: 'tuple' object does not support item assignment
    >

  • @adeebalamat172
    @adeebalamat172 2 ปีที่แล้ว

    I can pass my test now thanks to you

  • @lakshanj.kumara7648
    @lakshanj.kumara7648 ปีที่แล้ว

    mixed_list=["hello",-34,"java",True]
    print("1.",mixed_list[-1])
    mixed_list[1]="Hi"
    print("2.",mixed_list)
    mixed_tuple=(1,3,4,5)
    print("3.",mixed_tuple)

  • @EmereEmmanuel
    @EmereEmmanuel หลายเดือนก่อน

    My answer, hope i am doing well.
    1. ["True"]
    2. ["Hello", "Hi", "Java", "True"]
    3. [1, 100, 4, 5]

  • @mohammadabdullahaalforhad1375
    @mohammadabdullahaalforhad1375 2 ปีที่แล้ว

    mixed_list = ('Hello!', -34,'java', True )
    print('1.', mixed_list[0])
    print('2.', mixed_list[1])
    print('3.', mixed_list[2])
    print('4.', mixed_list[3])
    1. Hello!
    2. -34
    3. java
    4. True

  • @khaledelhoushi8834
    @khaledelhoushi8834 ปีที่แล้ว

    You can also call the length function on slicing. You can do it like this print(len(languages[0:3])).

  • @DigitalAcademyOnline
    @DigitalAcademyOnline 3 ปีที่แล้ว +2

    Learning Python is something you would like to get in your skills, but you do not know where to start? This NEW channel will help you out leaning Python Programming from scratch - for complete Beginners, Intermediate and Advanced Levels

  • @AbdulrahmanMuttakaJunju
    @AbdulrahmanMuttakaJunju ปีที่แล้ว

    really interesting videos. however am having challenge solving a problem related to tuple, can you be of help?

  • @joyceadhiambo9977
    @joyceadhiambo9977 2 ปีที่แล้ว

    you can not change the elements of a tuple .hence this is the output
    mixed_list=['Hello',-34,'Java',True]
    mixed_list[1]='Hi'
    print('2.',mixed_list)
    print('1.',mixed_list[-1])
    mixed_tuple=(1,3,4,5)
    mixed_tuple[1]=100
    print('3.',mixed_tuple)

  • @saregamapaz
    @saregamapaz 3 ปีที่แล้ว

    very clear and methodical presentation...THANKS

  • @kirankancham4938
    @kirankancham4938 3 ปีที่แล้ว

    Classes are very easy to understand

  • @ganneruvaramroshinichitti5407
    @ganneruvaramroshinichitti5407 3 ปีที่แล้ว

    thankyou sir .its really simply more explanative...

  • @edselnarvaez9667
    @edselnarvaez9667 2 ปีที่แล้ว

    Punit you are the best thanks a lot !

  • @jitendrakasaudhan
    @jitendrakasaudhan 4 ปีที่แล้ว +2

    I really like all your video tutorials :) its simple , clean and clear :) BTW which tool do you use to edit/create these videos ? it looks great !! :) 👍

  • @srhrithik5259
    @srhrithik5259 2 ปีที่แล้ว

    Thank you programiz

  • @Knochenkotzer01
    @Knochenkotzer01 2 ปีที่แล้ว

    Super great content Programiz, keep it up ✨

  • @shankarsai2067
    @shankarsai2067 4 ปีที่แล้ว +5

    Why don't we have a live interaction session with Punit sir????

  • @majidalich2947
    @majidalich2947 2 ปีที่แล้ว +1

    1. True
    2. ['Hello', ' Hi', 'Java' , 'True' ]
    error : you cant use assignment operator in case of tuples
    3. (1,3,4,5)

  • @SANGITA_SINGH1981
    @SANGITA_SINGH1981 3 ปีที่แล้ว

    Your videos are really very great

  • @daviddavila8289
    @daviddavila8289 ปีที่แล้ว

    12:15 Punit, why is the item “JavaScript” printed in a different color?

  • @sg8581
    @sg8581 ปีที่แล้ว

    Great videos, thanks a ton!

  • @nriezedichisom1676
    @nriezedichisom1676 3 ปีที่แล้ว +1

    Videos are perfect

  • @ahmedyousif4782
    @ahmedyousif4782 3 ปีที่แล้ว +1

    why the sound changed?

  • @adityagupta8950
    @adityagupta8950 2 ปีที่แล้ว

    sir if we want to change 2nd and last element of list at once then what we will use?.I tried this but its results in reducing of size of list.the immediate element after the first index value is only there and rest of the elements in list is removed.

  • @OptimusPrime-vy8vy
    @OptimusPrime-vy8vy 4 ปีที่แล้ว +1

    This is really well done thank you!

  • @mateenbutt3180
    @mateenbutt3180 3 ปีที่แล้ว

    hi, is it possible using .insert() on list, we treat list or tuple we want to add as like .extend() treats ?

  • @ohjinyoung4931
    @ohjinyoung4931 2 ปีที่แล้ว

    Very good!

  • @westonholmes9503
    @westonholmes9503 2 ปีที่แล้ว

    These videos are great

  • @BalaKrishnan-qk2zu
    @BalaKrishnan-qk2zu 3 ปีที่แล้ว

    This video is really helpful. Thanks a lot

  • @stefmyt5062
    @stefmyt5062 3 ปีที่แล้ว

    Amazing video, sir! Very useful!

  • @mohammedumair2968
    @mohammedumair2968 4 ปีที่แล้ว +2

    Good explanation sir 👏ossom
    Sir please make videos on *Data structure* sir please....

  • @sandipansarkar9211
    @sandipansarkar9211 3 ปีที่แล้ว

    great explanation

  • @harshad9203
    @harshad9203 2 ปีที่แล้ว

    1. 4
    2. hello, hi, java, true
    3. error

  • @lukedsouza7
    @lukedsouza7 4 ปีที่แล้ว +1

    Thanks Great Job!

  • @srhrithik5259
    @srhrithik5259 2 ปีที่แล้ว

    Thanks a lot 🤗🤗

  • @saurav2409
    @saurav2409 3 ปีที่แล้ว

    Thank u so, to this precised n to the point lecture ... 🥺

  • @georg101
    @georg101 4 ปีที่แล้ว

    I am waiting for more!

  • @ensonev8768
    @ensonev8768 3 ปีที่แล้ว

    Awesome. Keep going

  • @gabrielladangler1722
    @gabrielladangler1722 4 ปีที่แล้ว +1

    Awesome videos! Looking forward to the next one! :)

  • @mateenbutt3180
    @mateenbutt3180 3 ปีที่แล้ว

    Why output are same? when I use .copy() method.............
    old_list = [[1, 2, 3], [4, 5, 6], [7, 8, 'a']]
    new_list = old_list.copy()
    old_list[2][2] = 10
    print('Old List:', old_list)
    print('New List:', new_list)
    Output:
    Old List: [[1, 2, 3], [4, 5, 6], [7, 8, 10]]
    New List: [[1, 2, 3], [4, 5, 6], [7, 8, 10]]

    • @AryanSingh-ju6wn
      @AryanSingh-ju6wn 2 ปีที่แล้ว

      with .copy() it must not be creating a new memory location but rather linking the previous one to the new variable

  • @GiulioVonKerman
    @GiulioVonKerman 3 ปีที่แล้ว

    How can I change the position of an item in a list?

  • @kyrank.4321
    @kyrank.4321 3 ปีที่แล้ว

    Great videos, keep it up!!!

  • @sureshvarthya2250
    @sureshvarthya2250 2 ปีที่แล้ว

    True
    ["Hello", "Hi", "Java", True]
    error it does not support for reassigning values into the tuple ,because it is immutable

  • @harish0000
    @harish0000 4 ปีที่แล้ว

    Please also alow us to save our code in python compiler which is on your site

  • @mohammadabdullahaalforhad1375
    @mohammadabdullahaalforhad1375 2 ปีที่แล้ว

    Thanks

  • @Trazynn
    @Trazynn 4 ปีที่แล้ว +1

    I understand that tuples are faster and make more efficient use of memory. But is that their only purpose? They do seem to require a lot more effort than just using a list.

    • @programizstudios
      @programizstudios  4 ปีที่แล้ว +27

      No, efficiency is not the primary reason to use tuples. In fact, the difference in efficiency is insignificant for 99.9% of the applications.
      The primary benefit of using tuples is that it helps us create less error-prone code.
      For example,
      Imagine you own an ecommerce site and you need to send emails to all the users regarding a new policy change. To do so, you decided to store all the emails (from the database) in a collection so that you can send the emails at once.
      In such cases, it's better to use tuples because we know for sure that these emails won't change throughout the execution of the program. And if the tuple is accidentally modified by you or other developers, we get an error (which is a good thing). This helps us create less buggy code.
      Also, using a tuple makes our code more readable. It's because when we see a tuple we know for sure that this data cannot be modified.

  • @saravanaakavi2376
    @saravanaakavi2376 3 ปีที่แล้ว

    will you make a video as per viewer request?

  • @abdulquadiransari7476
    @abdulquadiransari7476 4 ปีที่แล้ว +1

    hey why the website went down . Why I am I unable to load the website?

    • @rayar2323
      @rayar2323 4 ปีที่แล้ว

      The website is up and running now

  • @kapibara2440
    @kapibara2440 10 หลายเดือนก่อน

    Super video, thank you❤

  • @nithyanagendran5661
    @nithyanagendran5661 3 ปีที่แล้ว

    Hello Sir, am having a doubt. I tried the following code .
    languages = ["Python","Java","Kotlin","C++"]
    languages[1:4] = ["Ruby","JS"]
    print(languages)
    and the result i got is :
    -------------------------------------
    ['Python', 'Ruby', 'JS']
    Why Kotlin didn't get printed ? what is wrong in this ?

    • @tizestaxd
      @tizestaxd 3 ปีที่แล้ว +1

      because you wrote 1:4 it should be 1:3
      look
      languages = ["Python","Java","Kotlin","C++"]
      languages[1:3] = ["Ruby","JS"]
      print(languages)
      result
      ['Python', 'Ruby', 'JS', 'C++']
      I hope i helped u have a good day

  • @favourudoh753
    @favourudoh753 3 ปีที่แล้ว

    amazing!!

  • @cadribopraiseoyo5636
    @cadribopraiseoyo5636 3 ปีที่แล้ว

    Instructor what's your name? I like your tutorials a lot.

  • @praveenasurya3211
    @praveenasurya3211 2 ปีที่แล้ว

    can you add subtitles too sir?

  • @ranjeet5806
    @ranjeet5806 3 ปีที่แล้ว +2

    Answer of the Exercise :
    1.True
    2.Hello---- edit: it prints the whole list
    a error that you cant use assignment operator in case of tuples
    3.1---- edit: it prints the whole tuple

  • @shadoestorme
    @shadoestorme 4 ปีที่แล้ว

    thank you!

  • @ahmedaltaf12131
    @ahmedaltaf12131 4 ปีที่แล้ว

    thank you so much omg

  • @sunnyraut3243
    @sunnyraut3243 3 ปีที่แล้ว

    1.True
    2.Hello Hii Java True
    3.Error cannot assign value to tuple

  • @datasciencetoday7127
    @datasciencetoday7127 8 หลายเดือนก่อน

  • @kushal-shaw-pvt
    @kushal-shaw-pvt 4 ปีที่แล้ว +1

    Sir please teach tkinter

  • @karanbirsingh5924
    @karanbirsingh5924 3 ปีที่แล้ว

    Lets we have 3 reviewers and 4 movies......how to code this

  • @kemaketseforkssebitiela3089
    @kemaketseforkssebitiela3089 5 หลายเดือนก่อน

    ❤i think i am going somewhere😅

  • @emrandafadar4445
    @emrandafadar4445 2 ปีที่แล้ว

    Your explaining style is very hard to understand
    You speak too fast
    You're writing your codes too fast
    And supporting logics aren't many
    And your coding font size is very small
    I am fully beginner, I can't catch it fast like others