0
how do you print for example the answer of 7*8 and the string hello on the same line?
thank you
8 Answers
+ 3
Cuneyt's solution works.
You can also use str() to turn stuff into strings.
print("Hello World " + str(7*8))
+ 2
You can also
print("Hello World! 7*8=", 7*8)
+ 1
You can use below code
Print("Hello World", 7*8)
+ 1
print("hello world" + str(7*8))
0
You can use format function as:
print("Hello World! {0}".format(7*8))
I think you are looking for this solution as I had the same doubt when I started to engage with python at beginner's level.
You can try out more with "format()" function.
0
my prefered is
print("Hello world!" %d) % (7*8)
0
Input: print(7*8 + 'hello')
Output: 56hello
- 1
use the code
result= 7*8
print("Hello world" +result)