What should I do to print both Text and calculation in python ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What should I do to print both Text and calculation in python ?

I know 6/2 is equal to 3. Can I print 'Question number 3' by writing print ('Question number' 6/2). What should I do to mix Text and calculation?

2nd Jun 2020, 11:06 AM
VISHAL NAGAR
1 Answer
0
Althrough there will be a mistake to write print("Answer is "+6//2) or print("Answer is " 6//2) We can still declare a variable, make it string after calculations and then we just make it like this: a=str(6//2) print("Answer is "+a) https://code.sololearn.com/c88oTl1b6WlD/?ref=app
17th May 2022, 8:00 AM
SelfyTheMentalist
SelfyTheMentalist - avatar