+ 1
How can I write text and a variable in a "print" command at the same time?
Example: variable = 0 print("Text:", variable) Output: Text: 0
11 Answers
+ 3
You have to convert the var x to string like this
x = 1
x = str(x)
Please feel free to dm if you have any doubts, or u can post here, Royalx Music
+ 3
I guess the answer ur
Looking is this
For python do:
x = "This is string"
print("Text: " + x)
+ 3
Welcome
+ 1
x="something"
print(x)
+ 1
Thanks!!!!! ๐๐๐
0
I edited the description, there is an example.
0
I understand did you mean
x = "awesome"
print("Python is " + x)
0
Thank you guys :))
But it doesn't work if "x" is a number. ๐
0
Royalx Music welcome ๐
0
you can also do
print(fโText: {variable}โ)
It works whether or not โvariableโ is an integer.