for loop in python part-2 | Lec-11

In this video, I have talked about the fundamentals of programming and Python. If you complete this, you will be well-versed in using list for different use case.
paragraph = """ Ralph Kimball founded the Kimball Group. Since the mid-1980s, he has been the
data warehouse and business intelligence industry’s thought leader on the dimen
sional approach. He has educated tens of thousands of IT professionals. The Toolkit
books written by Ralph and his colleagues have been the industry’s best sellers
since 1996. Prior to working at Metaphor and founding Red Brick Systems, Ralph
coinvented the Star workstation, the fi rst commercial product with windows, icons,
and a mouse, at Xerox’s Palo Alto Research Center (PARC). Ralph has a PhD in
electrical engineering from Stanford University """
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

Пікірлер: 17

  • @amazhobner
    @amazhobner4 ай бұрын

    lst = [202, 165, 89, 76, 12] number_to_insert = 10 for i, num in enumerate(lst): if num

  • @VivekKhare-z1m
    @VivekKhare-z1m22 сағат бұрын

    Assignment: lst = [202,165,89,76,12] number_to_insert = 15 index = 0 for number in lst: if number index = index break else: index = index + 1 lst.append(None) for insert_value in range(len(lst)-1,index,-1): lst[insert_value] = lst[insert_value - 1] lst[index] = number_to_insert

  • @sarveshkumar-tq4fn
    @sarveshkumar-tq4fn2 ай бұрын

    # Inserting Element in List lst = [18,86,77,102,730] inserted_number = 100 index = 0 for num in lst: if(num>inserted_number): index = index break else: index = index + 1 lst.append(None) for i in range(len(lst)-1,index,-1): lst[i] = lst [i-1] lst[index] = inserted_number logging.info(lst)

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

    lst = [202,165,89,76,12] num_insert = 120 index = len(lst)-1 for i in range(len(lst)-1,-1,-1): if lst[i] > num_insert: index = index break else: index -=1 lst.append(None) index +=1 for j in range(len(lst)-1,index,-1): lst[j] = lst[j-1] lst[index] = num_insert print(lst)

  • @satyamkumarjha4185
    @satyamkumarjha41855 күн бұрын

    8

  • @user-pb7nb2lc7f
    @user-pb7nb2lc7f4 ай бұрын

    #Assignment: Insert number in such a way that list is sorted in Descending order lst = [202,165,89,76,12] number_to_insert = 15 index = 0 for num in lst: if num index = index else: index += 1 lst.append('None') for i in range(len(lst)-1,index,-1): lst[i] = lst[i-1] lst[index] = number_to_insert print(lst) Hi @Manish, Is there any optimized way to traverse , lets say if i've a list of 10k element, then here traversing will take more time.

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

    # Assignment lst = [202, 165, 89, 76, 12] index = 0 number_to_insert = 15 for number in lst: if number index = index else: index +=1 print(index) lst.append(None) for i in range(len(lst)-1,index,-1): lst[i] = lst[i-1] lst[index] = number_to_insert logger.info(f"new list {lst}")

  • @raajnghani
    @raajnghani4 ай бұрын

    index = 0 number_to_insert = 15 lst = [202,165,89,76,12] for number in lst: if number

  • @divyaborse5866
    @divyaborse58662 ай бұрын

    list1 =[202,165,89,76,12] target =15 pos=0 if len(list1)==0: list1.append(target) elif len(list1) == 1 and list1[0] list1.append(list1[0]) list1[0] =target elif len(list1) == 1 and (list1[len(list1)-1] > target or list1[0] > target): list1.append(target) else: for i in range(len(list1)): if list1[i] pos= i break print(pos) list1.append(None) print(len(list1)) for i in range(len(list1)-1,pos-1,-1): list1[i] =list1[i-1] list1[pos]= target print(list1)

  • @vishnu000001
    @vishnu0000014 ай бұрын

    lst = [202,165,89,76,12] number_to_insert = 15 index = 0 for i in lst: if i > number_to_insert: index = index +1 else: break print(index) lst.append("None") print(lst) for j in range(len(lst)-1,index,-1): lst[j] = lst[j-1] lst[index] = number_to_insert print(lst)

  • @nabyenduKuiti
    @nabyenduKuiti28 күн бұрын

    How to practice loop ?

  • @manish_kumar_1

    @manish_kumar_1

    27 күн бұрын

    Geeks for geeks website

  • @anubhavsharma9449
    @anubhavsharma94494 ай бұрын

    why you deleted pyspark playlist?

  • @ShubhamRai06

    @ShubhamRai06

    4 ай бұрын

    Hai to bhai, kaha delete ki ,

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

    # Assignment Problem lst = [202,165,89,76,12] number_to_insert = 15 # Insert the number 15 in such a way that list is sorted in desending order. index = 0 # finding the index of the place where number needs to be added for number in lst : if number index = index break else: index = index +1 logger.info(index) lst.append(None) logger.info(lst) # [202, 165, 89, 76, 12, None] # traversing the list for i in range(len(lst)-1,index,-1): # (5,4,-1) lst[i] = lst[i-1] lst[index] = number_to_insert logger.info(lst)

  • @anmolgupta1348
    @anmolgupta13482 ай бұрын

    from loguru import logger list=[202,165,89,76,12] index=0 num_insert=15 list_asc=list[::-1] for i in list_asc: if i>num_insert: index=index break else: index=index+1 list_asc.append(None) logger.info(list_asc) for j in range (len(list_asc)-1,index,-1): list_asc[j]=list_asc[j-1] list_asc[index]=num_insert list_asc1=list_asc[::-1] logger.info(list_asc1)

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

    # 1st Way lst = [12, 76,89,165,202] lst.append(15) lst.sort() print(lst) #2nd Way lst_1 = [12, 76,89,165,202] index=0 logger.info(f" index value is {index} List Value is {lst_1}") for i in range(len(lst_1)-1): if lst_1[i]>120: index=index logger.info(f"if loop value i is {i} and index value is {index}") else: index=index+1 logger.info(f"Else loop value i is {i} and index value is {index}") lst_1= lst_1 + [None] print(lst_1) for j in range(len(lst_1)-1,index,-1): print(f"J value is: {j}") print(f"list value is: {lst_1[j]}") lst_1[j]=lst_1[j-1] print(lst_1) lst_1[index]=120 print(lst_1)