python - Getting a none type error while iterating a dictionary? -


this question has answer here:

code:-

def displayhand(hand):     letter in hand.keys():        j in range(hand[letter]):          print letter,              # print on same line     print                               # print empty line  hand = {'a':1, 'q':1, 'l':2, 'm':1, 'u':1, 'i':1}  print displayhand(hand) 

output:-

a m l l q u none 

req output:-

a m l l q u 

kindly give logical solution.

your function not return when print result of function prints none

displayhand(hand) # execute function without printing result, in case none 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -