Python 3 - Count the frequency of words appearing in a string | Example Programs

Sdílet
Vložit
  • čas přidán 29. 12. 2018
  • Write a simple python code to Count the frequency of words appearing in a string.
  • Věda a technologie

Komentáře • 13

  • @icyQaisy_
    @icyQaisy_ Před 2 lety +5

    this video actually helped me out instead of the other useless online tutorials, thanks a bunch!!

  • @SL-me5tb
    @SL-me5tb Před rokem +1

    THIS GUY RIGHT HERE SAVES LIVES!!!!!

  • @2roomii
    @2roomii Před 3 lety +3

    Thanks a lot!!!

    • @Java2Novice1016
      @Java2Novice1016  Před 3 lety

      You're welcome! Please do subscribe to the channel if you like it.

  • @snehashukla4415
    @snehashukla4415 Před 3 lety +1

    Can you tell how can I print the count in decreasing order ? In your example hello word comes twice, so first hello:2 should be printed, then other word's frequency.

    • @kushaltanna5569
      @kushaltanna5569 Před 3 lety +1

      You have Stored the frequency values in dictionary.. use dictionary.value() function and sort them afterward if you only want values from the dict.
      If you want the keys too. Then simply cast the dict to list and sort it using sorted function.
      I believe it will work.

  • @jekhaarchana8207
    @jekhaarchana8207 Před 3 lety +1

    How to print as a string ??. Without using list.. I want to print this way hi2hello3how2... and so on..

  • @pawelmykytuk7636
    @pawelmykytuk7636 Před 3 lety

    Hi! Could you explain please where is 'i' coming from? Also, if you can, explain what {} means?

    • @pawelmykytuk7636
      @pawelmykytuk7636 Před 3 lety

      you are printing (d) but what is 'd'?

    • @Tae_Grixis
      @Tae_Grixis Před 3 lety

      The i is a variable representing each word in the string. You can use any other word as the variable, as long as it is not a keyword, I believe.

    • @TrackMonkey327
      @TrackMonkey327 Před 3 lety +2

      {} is the empty dictionary