I wanna convert this to a regular for loop
for i in sorted(pdict.item开发者_开发技巧s(),key=lambda x:x[1],reverse=True):
            if(i[1]<rating):
                print("Jersey number: "+str(i[0])+", Rating: "+str(i[1]))
you mean like this?
for i in pdict.items():
    if(i[1]<rating):
        print("Jersey number: "+str(i[0])+", Rating: "+str(i[1]))
convert this to a regular for loop
Ok, here you go.
for i in pdict.items():
    if i[1] < rating:
        print("Jersey number: " + str(i[0]) + ", Rating: " + str(i[1]))
But perhaps you wanted to clarify your question?
You can also make i more explicitly defined by specifying that two values are coming from .items(): the dictionary key and the dictionary value. The syntax below makes that more clear.
for key, value in pdict.items():
    if value < rating:
        print(f"Jersey number: {key}, Rating: {value}")
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论