+ 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

13th May 2019, 12:22 PM
Akko Rishtar
2 Respostas
+ 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
13th May 2019, 12:58 PM
Anna
Anna - avatar
0
Thanks
13th May 2019, 1:00 PM
Akko Rishtar