+ 1
Is there a more efficient way of adding a variable to a string?
https://code.sololearn.com/cgjPbKOqr6TI/?ref=app Disclamer: I'm learning my first language and trying to find out what is possible and how
2 Answers
+ 4
num = 7
print("number is " + str(num))
print("number is", num)
print("number is %d" % (num,))
print(f"number is {num}")
will all lead to the same result
0
Thanks