Difference Between List and Tuple in Python | Python Interview Questions and Answers | List vs Tuple

Поделиться
HTML-код
  • Опубликовано: 10 янв 2025

Комментарии • 97

  • @Codeyug
    @Codeyug  2 года назад +16

    We can unpack list also.

    • @barsaprusty4939
      @barsaprusty4939 2 года назад +3

      I was just going to scold u black and blue for that🤣

    • @Dabber7
      @Dabber7 2 года назад +1

      a,b,c,d=[21,32,93,'hello',5]
      print(c)
      a,b,c,d='ABC',21,32,93,'hello',5
      print(c)
      I am facing the same issue for both

    • @barsaprusty4939
      @barsaprusty4939 2 года назад +1

      @@Dabber7 thats what happens.. we can unpack list too... not everyone who teaches in youTube is correct all the time...

    • @sagarmasal1242
      @sagarmasal1242 Год назад

      yes its correct
      it is possible to unpack list also.
      list and tuple both we can do packing and unpacking

    • @luckyrajput2642
      @luckyrajput2642 9 месяцев назад +1

      What is meant by pack/unpack ? 😅😅

  • @parthdange755
    @parthdange755 Год назад +17

    i dont usually comment on youtube but man what a great teaching every line with example...subscibing you

    • @Codeyug
      @Codeyug  Год назад +1

      Thanks and please do share..

  • @sumantwankhede
    @sumantwankhede 2 года назад +4

    Nice vdo..we can do comprehension of tuple by using its type
    print(tuple(i*2 for i in range(2)) ) # Tuple (0, 2)
    print({i:i*2 for i in range(2)} ) # dict {0: 0, 1: 2}
    l = [2,4,6]
    print ([i*2 for i in l if i > 1] )# List [4, 8, 12]
    print({i*2 for i in l if i > 1 }) # set {8, 4, 12}

    • @Codeyug
      @Codeyug  2 года назад +5

      But, actually it is generator and not comprehension.. Please check type here...

  • @Indian-foodytraveller
    @Indian-foodytraveller 2 года назад +4

    Very nice thankyou so much it was realy different from others video

    • @Codeyug
      @Codeyug  2 года назад

      Thank you.. Please share with friends..

  • @MahbubAlam-ey7nz
    @MahbubAlam-ey7nz 2 года назад +8

    out of the world explanation

    • @Codeyug
      @Codeyug  2 года назад

      Keep learning

  • @Rahul_Patil_11
    @Rahul_Patil_11 Год назад +3

    Kaash aapkee jaisa sir hamare college m hota🥹🙂

  • @shyamkaladlagopal2
    @shyamkaladlagopal2 Год назад +2

    well explanation sir....

  • @fabeezsm7056
    @fabeezsm7056 Год назад +3

    we can unpack list and tuples . when i tried for output both came without error. i was wondering what am i wrong or my computer is

  • @gaurav6997
    @gaurav6997 Год назад +2

    Your explanation is amazing

    • @Codeyug
      @Codeyug  Год назад

      Thanks and check playlists please

  • @johnsnow007
    @johnsnow007 2 года назад +1

    Thank you so much darling 💓

  • @divyrajverma8286
    @divyrajverma8286 Год назад +2

    हर हर महादेव जय माँ भवानी जय श्रीराम जय माँ सीता जय हनुमानजी 🙏🙏🙏🙏🙏❤❤❤❤❤❤❤❤🚩🚩🚩🚩🚩🚩🚩🚩🚩🚩

  • @VishalDubey-oi3rq
    @VishalDubey-oi3rq 2 года назад +2

    nyc but we can unpack list also.. try it guys as same as tuple

  • @vintagex4350
    @vintagex4350 2 года назад +1

    Your teaching techniques is too good

    • @Codeyug
      @Codeyug  2 года назад

      Thanks a lot

  • @ComedyAlexa
    @ComedyAlexa Месяц назад +2

    Aaj Mera name esme example liya 😅😊😢😊

  • @gautamagarwal9761
    @gautamagarwal9761 2 года назад +1

    Best video 🙌

    • @Codeyug
      @Codeyug  2 года назад

      Thank you and keep going..

  • @yashanksaini3694
    @yashanksaini3694 7 месяцев назад +2

    L = ['hello' , 23 , 30 , 'ram']
    a,b,c,d = L
    print (b)
    unpacking ho rhi h

    • @Codeyug
      @Codeyug  7 месяцев назад

      Yess... Please check my comment below the video

  • @jobsenclave9991
    @jobsenclave9991 2 года назад +1

    Superb video. Very informative.

    • @Codeyug
      @Codeyug  2 года назад

      Thanks... Keep going

  • @pareshranjanrout9439
    @pareshranjanrout9439 11 месяцев назад +1

    ❤ Thank you Bhai

    • @Codeyug
      @Codeyug  11 месяцев назад

      Please check playlist section of this channel

  • @williamjayaraj2244
    @williamjayaraj2244 2 года назад +1

    Good explanation. Thanks.

    • @Codeyug
      @Codeyug  2 года назад

      Keep going.. 👍

  • @shubhangimahajan5089
    @shubhangimahajan5089 2 года назад +1

    Very clear explanation Sir👍

  • @shubhpatil18
    @shubhpatil18 2 года назад +1

    Nace presentation brother appreciate

    • @Codeyug
      @Codeyug  2 года назад

      Keep watching and keep learning

  • @AyeshaKhan-sj5eb
    @AyeshaKhan-sj5eb 2 года назад +1

    It is very good👍

    • @Codeyug
      @Codeyug  2 года назад

      Thank you and keep learning

  • @p.krajput0601
    @p.krajput0601 2 года назад +1

    Great 👍❤️

    • @Codeyug
      @Codeyug  2 года назад

      Keep going bro..

  • @nileshsinha957
    @nileshsinha957 Год назад +1

    unpacking can be happen in list

  • @naikajay_
    @naikajay_ 2 месяца назад

    7:36 is it the wrong you have said at this point, tupple can be modify, and list provide more security to data

  • @YUGBHARWAJ
    @YUGBHARWAJ 3 месяца назад +2

    Item ❌️ Atom ✅️

  • @riyasaxena5210
    @riyasaxena5210 Год назад

    Thanks 👍😊

  • @sudip_pandit
    @sudip_pandit 2 года назад +1

    thank you sir

    • @Codeyug
      @Codeyug  2 года назад

      Check playlists..

  • @a.agaming097
    @a.agaming097 Год назад +1

    At 6:53 you didn't provide parenthesis for tuple, then how can you define that tuple can be unpacked. I understand that the output will be the same but I am just trying to indicate your mistake.

    • @Codeyug
      @Codeyug  Год назад +1

      var1, var2, var3 = 10,20,30 is unpacking of tuple. I don't think there is a mistake.

  • @earth_1943
    @earth_1943 2 года назад +2

    We can unpack list like tuple I am able to do it .

  • @ravijeetsingh5135
    @ravijeetsingh5135 Год назад +1

    Nice

  • @KartikPandeyVlogs
    @KartikPandeyVlogs 2 года назад

    I was thinking packing n unpacking is able in list

    • @Codeyug
      @Codeyug  2 года назад

      Now, it's cleared... Right?

    • @KartikPandeyVlogs
      @KartikPandeyVlogs 2 года назад

      @@Codeyug yes and this ques was in my exam yesterday thanks ❤

  • @shrikantgedam2900
    @shrikantgedam2900 10 месяцев назад +1

    i tried unpacking with list as you said and it works.... how it is possible
    j, k, l, m, = [1, 5.4, 'abc', 2+3j]
    print(j)
    print(k)
    print(l)
    print(m)

    • @Codeyug
      @Codeyug  10 месяцев назад

      Working is changed into new version. I have also commented in the same video and pinned it

  • @InfotechSuraj
    @InfotechSuraj 2 года назад +2

    Amazing🙏

    • @Codeyug
      @Codeyug  2 года назад

      Thank you so much.. Keep learning from my channel. There are number of playlists

  • @gajananchapole1607
    @gajananchapole1607 2 года назад +1

    Very nice

    • @Codeyug
      @Codeyug  2 года назад

      Thanks...you can learn python from this channel

  • @vintagex4350
    @vintagex4350 2 года назад +1

    Osm brother

  • @ComedyAlexa
    @ComedyAlexa Месяц назад +1

    Why? Sir number 4 topic?

  • @kshitijpatil4133
    @kshitijpatil4133 Год назад +1

    sir, which software are you using for code in this video

  • @johnmartin9329
    @johnmartin9329 2 года назад +1

    aa,ba,ca,da=[1,5,3,4]
    print(aa,ba,ca,da)
    a,b,c,d=(1,2,4,5)
    print(a,b,c,d)
    both are giving same result in python 3.0 why

    • @Codeyug
      @Codeyug  2 года назад +1

      Sorry, we can unpack tuple.. I guess, I did mistake.

  • @skchannel2088
    @skchannel2088 Год назад +1

    Modification kelye list chahea ya tuple?

  • @samrat.02
    @samrat.02 2 года назад

    Good expl

    • @Codeyug
      @Codeyug  2 года назад

      Thanks

    • @samrat.02
      @samrat.02 2 года назад

      Hi bro if vs for loops plz 🙏 explan

  • @ramuyanamala1253
    @ramuyanamala1253 5 месяцев назад +1

    packin and unpacking is supporting list

  • @engineeringlife5391
    @engineeringlife5391 2 года назад +1

    But Maine list ke liye try kiya . Replit(online) pe .
    Unpacking ho raha hai . Pls help

    • @Codeyug
      @Codeyug  2 года назад

      Unpack hota hai... It depends on version I guess.. Comments check kro.

  • @atharvakulkarni4133
    @atharvakulkarni4133 19 дней назад

    One correction:
    List also supports unpacking :)

  • @sangeetadubey1589
    @sangeetadubey1589 Месяц назад +1

    😊❤❤❤

  • @samrat.02
    @samrat.02 2 года назад

    Hi bro oops in python explan 😊😊plz

    • @Codeyug
      @Codeyug  2 года назад

      Full playlist hai bro..

    • @samrat.02
      @samrat.02 2 года назад

      Thank you bro

    • @Codeyug
      @Codeyug  2 года назад

      Mila kya?

    • @samrat.02
      @samrat.02 2 года назад

      @@Codeyug yes bro mil gaya thank you bro

    • @Codeyug
      @Codeyug  2 года назад

      @@samrat.02 'oop using python codeyug' esse bhi mil jayega

  • @Chinmoy348
    @Chinmoy348 3 года назад +1

    Nice video bro

    • @Codeyug
      @Codeyug  3 года назад

      Thank you.. If Anything required, text me..

    • @Chinmoy348
      @Chinmoy348 3 года назад

      @@Codeyug sure bro

  • @KrunalDurne
    @KrunalDurne 5 месяцев назад

    U were wrong coz Unpacking is possible with list

  • @sanjaytakecare80
    @sanjaytakecare80 2 месяца назад +1

    Last difference is wrong

    • @Codeyug
      @Codeyug  2 месяца назад

      Yess..sorry for that

  • @Mykiti271
    @Mykiti271 2 года назад +1

    Bro plzz muj se insta pr rbta kren ya whatsapp prr muje python K bary mein ap se jan kari leni ha

    • @Codeyug
      @Codeyug  2 года назад

      Please ask here

  • @prabinasunani4021
    @prabinasunani4021 Год назад +1

    Thank you sir

  • @shaikmuheeb5526
    @shaikmuheeb5526 Год назад +1

    Nice