tuple in python | Lec-16

In this video, I have talked about the fundamentals of programming and Python. If you complete this, you will be well-versed in using tuples for different use cases.
Directly connect with me at:- topmate.io/manish_kumar25
Discord channel:- / discord
For more queries reach out to me on my below social media handle.
Follow me on LinkedIn:- / manish-kumar-373b86176
Follow Me On Instagram:- / competitive_gyan1
Follow me on Facebook:- / manish12340
My Second Channel -- / @competitivegyan1
Interview series Playlist:- • Interview Questions an...
My Gear:-
Rode Mic:-- amzn.to/3RekC7a
Boya M1 Mic-- amzn.to/3uW0nnn
Wireless Mic:-- amzn.to/3TqLRhE
Tripod1 -- amzn.to/4avjyF4
Tripod2:-- amzn.to/46Y3QPu
camera1:-- amzn.to/3GIQlsE
camera2:-- amzn.to/46X190P
Pentab (Medium size):-- amzn.to/3RgMszQ (Recommended)
Pentab (Small size):-- amzn.to/3RpmIS0
Mobile:-- amzn.to/47Y8oa4 ( Aapko ye bilkul nahi lena hai)
Laptop -- amzn.to/3Ns5Okj
Mouse+keyboard combo -- amzn.to/3Ro6GYl
21-inch Monitor-- amzn.to/3TvCE7E
27-inch Monitor-- amzn.to/47QzXlA
iPad Pencil:-- amzn.to/4aiJxiG
iPad 9th Generation:-- amzn.to/470I11X
Boom Arm/Swing Arm:-- amzn.to/48eH2we
My PC Components:-
intel i7 Processor:-- amzn.to/47Svdfe
G.Skill RAM:-- amzn.to/47VFffI
Samsung SSD:-- amzn.to/3uVSE8W
WD Blue HDD:-- amzn.to/47Y91QY
RTX 3060Ti Graphic card:- amzn.to/3tdLDjn
Gigabyte Motherboard:-- amzn.to/3RFUTGl
O11 Dynamic Cabinet:-- amzn.to/4avkgSK
Liquid cooler:-- amzn.to/472S8mS
Antec Prizm FAN:-- amzn.to/48ey4Pj

Пікірлер: 19

  • @bolisettisaisatwik2198
    @bolisettisaisatwik21982 ай бұрын

    Quick Notes: o Tuple is a data storage or a data structure or data type object in Python. A tuple can be updated by adding new values into it but cannot reassign an existing value by indexing method. The main features of tuples are: o Tuple: tuple = (1, 2, True, abcD) o Tuple gives an ordered output irrespective of input order. o Tuple is immutable object. o .count(2): gives the count of number of occurrences of 2 in the list or tuple. o Tuple.count(2)  1 o index(2): will give the First occurrence of the index number of the argument or number passed. o Tuple.index(2)  1

  • @muktanandzarapkar5841
    @muktanandzarapkar5841Ай бұрын

    import math t1 = (10, 2, 3, 5) t2 = (3, 6, 4, 3) t3=() for i in range(len(t1)): t3 = t3 + (pow(t1[i],t2[i]),) print(t3)

  • @user-sf7xi7zw6f
    @user-sf7xi7zw6fАй бұрын

    t1 = (10, 2, 3, 5) t2 = (3, 6, 4, 3) lst = [] for i in range(len(t1)): j = t1[i]**t2[i] lst.append(j) print(tuple(lst))

  • @SudiptaTripathy
    @SudiptaTripathy21 күн бұрын

    tuple1=(10,2,3,5) tuple2=(3,6,4,3) final_res=() for i in range(len(tuple1)): new_var=tuple1[i]**tuple2[i] tuple3=tuple([new_var]) final_res=final_res+tuple3 print(final_res)

  • @tajveertyagi3084
    @tajveertyagi30842 ай бұрын

    input_tuple = ([5, 6], [6, 7, 8, 9], [3]) result=() for sublist in input_tuple: for element in sublist: result=result+(element,) print(result)

  • @safiadawood5637
    @safiadawood56372 ай бұрын

    Q1: test_tuple = ( [5,6], [6,7,8,9], [3]) result = () for lst in test_tuple: result = result + tuple(lst) print(result) Q2: tuple1 = (10,2,3,5) tuple2 = (3,6,4,3) output = () for i in range(len(tuple1)): output = output + (tuple1[i] ** tuple2[i],) print(output)

  • @bolisettisaisatwik2198
    @bolisettisaisatwik21982 ай бұрын

    I am getting this error when trying to convert the list into a tuple Error= TypeError: 'tuple' object is not callable My approach to the code. Tryed multiple other things, still seeing the same issue. print(list_to_tuple(result)) tuple_test = ([4, 5], [9, 7, 3], [81, 5]) result = [] def list_to_tuple(*args): return tuple(args) for lst in tuple_test: new_tuple = lst result.extend(new_tuple) print(list_to_tuple(result))

  • @anuragdasgupta6203
    @anuragdasgupta6203Ай бұрын

    1. input = ([5, 6], [6,7,8,9], [3]) output = () for i in input: output = output + tuple(i) print (output) 2. tuple1 = (10, 2, 3, 5) tuple2 = (3, 6, 4, 3) result = [] # print(type(s)) for i in range(len(tuple1)): n = tuple1[i] ** tuple2[i] result.append(n) print(tuple(result))

  • @divyaborse5866
    @divyaborse5866Ай бұрын

    question 1: test_tuple =([5,6],[3]) res_tuple = () list1 = [] for i in test_tuple: print(i) for j in i: list1.append(j) print(tuple(list1)) Question 2: t1 =(10,2,3,5) t2 = (3,6,4,3) final_res = () for i in range(0,len(t1)): #res.append(t1[i] ** t2[i]) result = t1[i] ** t2[i] res = (result,) final_res = final_res + res print(final_res)

  • @bolisettisaisatwik2198
    @bolisettisaisatwik21982 ай бұрын

    How is everyone's second answer the same and none's is failing? When both the tuples are being iterated by i, then the second tuple has one less argument to pass and so the execution will fail. I think the correct way to handle that error would be this way. tuple1 = (10,2,3,5,6) tuple2 = (3,6,4,3) result = () for i in range(len(tuple1)): if i in range(len(tuple2)): result = result + (tuple1[i] ** tuple2[i],) else: break print(result) Note: Considering the input taken is same as the inputs provided by Manish. I might be wrong. Please educate, if i am wrong.

  • @vinu11sharma
    @vinu11sharma2 ай бұрын

    tuple1 = (10, 2, 3, 5) tuple2 = (3, 6, 4, 3) final=() for i in range(len(tuple1)): rslt=tuple1[i] ** tuple2[i] print(type(rslt)) rslt1=(rslt,) print(type(rslt1)) final=final+rslt1 print(final)

  • @AnuragRaut-ry2oq
    @AnuragRaut-ry2oq22 күн бұрын

    Problem 1 test_tuple = ([5,6],[6,7,8,9],[3]) result = () for lst in test_tuple: new_variable = tuple(lst) result = result + new_variable logger.info(f"The output tuple is {result}") Problem 2 tuple1 = (10,2,3,5) tuple2 = (3,6,4,3) final_tuple = () for i in range(len(tuple1)): result = (tuple1[i] ** tuple2[i],) final_tuple = final_tuple + result logger.info(f"The output tuple is {final_tuple}")

  • @user-sf7xi7zw6f
    @user-sf7xi7zw6fАй бұрын

    test_tuple = ([5,6], [6,7,8,9], [3]) # output: (5, 6, 6, 7, 8, 9, 3) lst = [] for i in test_tuple: if len(i) == 0: lst.append(i) else: for j in i: lst.append(j) print(tuple(lst))

  • @nupoornawathey100
    @nupoornawathey1003 ай бұрын

    Q1: lst=[] for tup in test_tuple: for t in tup: lst.append(t) print(tuple(lst)) # (5, 6, 6, 7, 8, 9, 3) Q2: tup=() for num in range(len(tuple1)): tup = tup + (tuple1[num] ** tuple2[num],) print(tup)

  • @ankitdhurbey7093
    @ankitdhurbey70933 ай бұрын

    Q2 : tuple1 = (10,2,3,5) tuple2 = (3,6,4,3) final_result = () for i in range(len(tuple1)): exp = tuple1[i]**tuple2[i] final_result = final_result + (exp,) print(final_result)

  • @vinu11sharma
    @vinu11sharma2 ай бұрын

    test_tuple=([5, 6], [6, 7, 8, 9],[3]) print(test_tuple) result=() for n in test_tuple: break_tuble = tuple(n) result=result+break_tuble print(break_tuble) print(result) print(result) result1=[] for n1 in test_tuple: break_tuble1=n1 result1=result1+break_tuble1 print(break_tuble1) print(result1) print(result1)

  • @hariharanraman4181
    @hariharanraman41812 ай бұрын

    Q1: from loguru import logger tuple_1=([5,6],[6,7,8,9], [3]) result=() result1=[] result1_tuple=() for lst in tuple_1: variable_name=tuple(lst) result=result+variable_name logger.info(result) for lst_1 in tuple_1: result1.extend(lst_1) result1_tuple=tuple(result1) logger.info(result1_tuple) Q2: from loguru import logger tuple1 = (10, 2, 3, 5) tuple2 = (3, 6, 4, 3) result=[] iterator=0 for t1 in tuple1: result.append(t1**tuple2[iterator]) iterator=iterator+1 logger.info(tuple(result))

  • @Cherry29-no9pb
    @Cherry29-no9pb2 ай бұрын

    Question1:: example1_tuple=([5,6],[6,7,8,9],[3]) example1_new_tuple=[] for i in example1_tuple: example1_new_tuple=example1_new_tuple+i example1_new_tuple=tuple(example1_new_tuple) logger.info(example1_new_tuple) Question2:: tuple1 = (10,2,3,5) tuple2 = (3,6,4,3) final_tuple=() for i in range(len(tuple1)): final_tuple=final_tuple+(tuple1[i]**tuple2[i],) logger.info(final_tuple)