(Apr-27-2017, 04:47 PM)idontreallywolf Wrote: @snippsat Define "not nice"
num = 4
maxnum = 14
spades = 3
# Not nice
print("Player Hand Total is "+str(num)+"/"+str(maxnum)+" with Ace of Hearts and "+str(spades)+" of Spades")
# String formattting {} was new in Python 2.6
print("Player Hand Total is {}/{} with Ace of Hearts and {} of Spades".format(num,maxnum,spades))
# New in Python 3.6 f-string it's what we all be using in future
print(f"Player Hand Total is {num}/{maxnum} with Ace of Hearts and {spades} of Spades")
Output:
Player Hand Total is 4/14 with Ace of Hearts and 3 of Spades
Player Hand Total is 4/14 with Ace of Hearts and 3 of Spades
Player Hand Total is 4/14 with Ace of Hearts and 3 of Spades