python - Getting a none type error while iterating a dictionary? -
this question has answer here:
- python function prints none 1 answer
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
Post a Comment