Apr-27-2017, 12:51 PM
(This post was last modified: Apr-27-2017, 12:51 PM by idontreallywolf.)
All you have to do is to convert the numbers by using
python 2.x
( you dont need to use str() because it will already be given as a string )
str()
function to strings and then concatenate
them by usingpython 2.x
num = 4 maxnum = 14 spades = 3 print "Player Hand Total is "+str(num)+"/"+str(maxnum)+" with Ace of Hearts and "+str(spades)+" of Spades"python 3.x
num = 4 maxnum = 14 spades = 3 print("Player Hand Total is "+str(num)+"/"+str(maxnum)+" with Ace of Hearts and "+str(spades)+" of Spades")BUT in your case i would use something like:
( you dont need to use str() because it will already be given as a string )
lst = ['AH','3S'] # python 2.7 print "Player Hand Total is "+(lst[1][0])+" Spades" # python 3.x print("Player Hand Total is "+(lst[1][0])+" Spades")in this case
[1]
is for accessing the second item which is 3S
and [1][0]
is for accessing the first string-element of 3S
which is '3'