How do i convert an f-string in python so that it can be printed by python version older than 3.6?
print(f"Player 1: {move1} Player 2: {move2}")
When I try to run this in Python (3.5.3) it gives me a syntax error.
How do i convert an f-string in python so that it can be printed by python version older than 3.6?
print(f"Player 1: {move1} Player 2: {move2}")
When I try to run this in Python (3.5.3) it gives me a syntax error.
print("Player 1: {move1} Player 2: {move2}".format(move1=move1, move2=move2))
will work in most recent versions of python. As will
print("Player 1: {} Player 2: {}".format(move1, move2))
and if you want to use the old formatting syntax that'll work in python2 as well:
print("Player 1: %s Player 2: %s" % (move1, move2))