+ 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 Respuestas
+ 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.