I'm working through the edx python course. I've done everything correctly in the last assignment. However, I'm struggling with this print issue.
I have a function displayHand(hand)
which essentially takes a dictionary with keys being letters and values be the number of occurrences of the letters. The function then prints a string with each key appearing the same number of times as its value. So for example if
hand={a:3, b:4, c:1}
displayHand(hand)=a a a b b b b c
Now in the program for any given hand it wants me to display it using the displayHand
function with the text "current hand: "
Again, if hand={a:3, b:4, c:1}
the program should display
current hand: a a a b b b b c
How do I do this with a print statement? I've tried print("current hand"+str(displayHand(hand))
, but this first evaluates the function and then just prints None
. I can't put print("Current Hand: ")
and displayHand(hand)
directly underneath, because then they print on different lines. I need to get them to print on the same line.