OrderedDict Problem | HackerRank | Python | Collections | OrderedDict

Поделиться
HTML-код
  • Опубликовано: 20 авг 2024
  • This video is about OrderedDict from collections in Python.
    Ordinary dictionary doesn't preserved the insertion order till version python 3.6 but in OrdererdDict() the insertion order are preserved.
    stackoverflow....
    Problem: www.hackerrank...
    Sample Code:www.coderscart...
    For 1 : 1 Tutoring
    WhatsApp contact : 7278222619
    mail: jaiswalsatya93@gmail.com
    You can support via UPI : sattujaiswal@okhdfcbank
    Follow us on:
    Whatsapp:
    chat.whatsapp....
    Facebook:
    / codingcart
    Linkedin:
    / satyendra-jaiswal-9035...
    / codingcart
    Instagram:
    / codingcart
    #HackerRank #Python #OrdererdDict()

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

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

    Excellent explanation. Really it's very helpful

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

    Great going bro..very helpful for beginners like me

  • @NehaKumari-tt1fn
    @NehaKumari-tt1fn 4 года назад +2

    Thanks for uploading these videos....it’s really helpful

  • @mayankkumar-fm1er
    @mayankkumar-fm1er 4 года назад +3

    Really helpful, keep it up

  • @ddaanniieellllee
    @ddaanniieellllee 4 года назад +1

    thanks for this! subscribed! hope you keep making videos!

  • @Anishkumar-uo9cf
    @Anishkumar-uo9cf 4 года назад +1

    Thank you 😊

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

    please come up with more videos

  • @gnanatsg3052
    @gnanatsg3052 4 года назад +1

    Jaswal, Your explanation is clear. as a beginner i learned a lot from your videos. Can you please make more videos on hacker rank challenges. I know its bit too much to ask for all but there are more people like me practicing to code but couldn't becoz of incomplete knowledge. your help will be highly appreciated.

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

      Glad you liked it.
      Sure will definitely, stay connected.
      Keep Learning keep supporting 😊

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

    Whats wrong in my code both expected output and my output are same but its showing wrong answer. Can anyone help me please?
    from collections import OrderedDict N=int(input()) ordered_dict=OrderedDict() for i in range(N): string=input() list1=string.split() newstr="" for i in range(len(list1)-1): newstr+=" "+list1[i] if newstr in ordered_dict: ordered_dict[newstr]=ordered_dict[newstr]+int(list1[-1]) else: ordered_dict[newstr]=int(list1[-1])
    for key,value in ordered_dict.items(): print(key,str(value))

  • @RIYAZALI-hy8bw
    @RIYAZALI-hy8bw 4 года назад

    Kuch samajh nhi aya par achha laga sun k😂😂

  • @helloworld2458
    @helloworld2458 4 года назад +1

    can you solve with normal dictionary or you havw to use ordereddict()? my friend told me ordereddict is dead and useless now.

    • @codingcart
      @codingcart  4 года назад +1

      Ordinary dictionary doesn't preserved the insertion order till python version 3.6 Now its updated you can solve with normal dictionary.
      Try this:
      od=dict()
      for i in range(int(input())):
      k,v=input().rsplit(' ',1)
      if k in od:
      od[k]=int(od[k])+int(v)
      else:
      od[k]=v
      for k,v in od.items():
      print(k,v)