Home > Mobile >  how can I make it that the list updates itself?
how can I make it that the list updates itself?

Time:05-06

In every "for" loop, two items (user and likes) are taken from the "Data" list and are added to a separate list (scoreboard). I am trying to detect if "user" already exists in the scoreboard list. If it does exist, then I try to take the item that comes after "user" in the scoreboard list (which would be the previous "likes" item) and add the new "likes" item to it, after that I try to set the new "likes" item to the new value. but i couldn't make it work.

   def likecount():
        scoreboard = []
        for t in range(0,len(Data),3):
            user = Data[t]
            likes = Data[t   2]
            if user not in scoreboard:
                scoreboard.append(user), scoreboard.append(likes)
            else:
                scoreboard[(scoreboard.index(user)   1)]   likes == scoreboard[(scoreboard.index(user)   1)]
                
                    
        for i in range(0,len(scoreboard),2):
            print (scoreboard[i],scoreboard[i 1], end= "\n")

#Data list:

['Rhett_andEmma77', 'Los Angeles is soooo hot', '0', 'Tato', 'Glitch', '1', 'Aurio', 'April fools tomorrow', '4', 'nap', 'The bully**', '3', 'NICKSION', 'Oops', '6', 'stupidfuck', 'hes a little guy', '5', 'database', 'Ty', '1', 'stupidfuck', 'possible object show (objects needed)', '3', 'NightSkyMusic', 'nicotine takes 10 seconds to reach your brain', '27', 'stupidfuck', '@BFBleafyfan99 be   anii e', '4', 'Odminey', 'Aliveness', '26', 'stupidfuck', '@techness2011 the', '5', 'techness2011', 'Boomerang', '1', 'saltyipaint', 'April is r slur month', '5', 'HENRYFOLIO', 'flip and dunk', '4', 'SpenceAnimation', 'Got Any grapes            
  • Related