INTERVIEW QUESTION - Conversion of two list into Dictionary Using Python

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • INTERVIEW QUESTION - Conversion of two list into Dictionary Using Python
    GitHub Link:- github.com/net...
    ~-~~-~~~-~~-~
    Please watch: "LRU Cache (With Python Code) "
    • LRU Cache Implementati...
    ~-~~-~~~-~~-~

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

  • @techiewithcamera
    @techiewithcamera Год назад +8

    My Solution:
    def list_to_dict(list1, list2):
    dict={}
    for i in range(len(list1)):
    dict[list1[i]]=list2[i]
    print(dict)

    • @sonusah6620
      @sonusah6620 9 месяцев назад

      Thank you for the amazing solution

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

    dict = {key:value for (key, value) in zip(list1, list2)}

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

    def list_do_list():
    x=[1,2,3]
    y=["one","two","three"]
    print(dict(zip(x, y, )))
    list_do_list()

  • @srisangeeth4131
    @srisangeeth4131 Месяц назад

    Your Tutorials about python interview questions are really fantastic ,I understood well and i done with my own examples.If dictionary to list what can we do??

  • @shubhimanocha2620
    @shubhimanocha2620 Месяц назад

    l1=['shubhi','geek','meet','reema','seema']
    l2=[600,800,1200,900]
    d1={}
    for k,v in zip(l1,l2):
    d1[k]=v
    print(d1)

  • @niraja1994
    @niraja1994 18 дней назад

    list1 = ['NAINA', 'KIMI', 'SHEENA']
    list2 = [123, 456,789]
    output = {list1[i]: list2[i] for i in range(len(list1))}
    print(output)

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

    Much apperciated. Love your work

  • @cinephile4371
    @cinephile4371 3 года назад +3

    very useful ...do more videos

  • @NISHASINGH-gs7wh
    @NISHASINGH-gs7wh 2 месяца назад +2

    My Solution:
    list1 = ["Naina", "kimi", "sheena"]
    list2 = [2356, 4578, 8956]
    dict={}
    for i in range(0, len(list1)):
    dict.update({list1[i] : list2[i] })
    print(dict)

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

    Awesome video

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

    Wow ❤️

  • @siddhigolatkar8558
    @siddhigolatkar8558 9 месяцев назад

    Thank you

  • @shaikjaffershareef448
    @shaikjaffershareef448 3 месяца назад

    what is zip fuction and how it works

  • @shareefshaik9848
    @shareefshaik9848 4 года назад

    how to convert the dictionary back to list

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

      use to_list function

    • @niveaprakash5482
      @niveaprakash5482 3 года назад +4

      dict1={1: 'one', 2: 'two', 3: 'three'}
      list1=[]
      for i in dict1.items():
      list1.extend(list(i))
      print(list1)

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

    Thank you