+ 3

How to print number with strings

you have to print a number with string....like x=45 print(x" this is the number you entered"). . output=45 this is the number you entered. . plz help

27th Apr 2018, 7:57 AM
Tamoor Ahmed
Tamoor Ahmed - avatar
5 Answers
+ 6
Adding onto Koushik Naskar's answer x=int(input()) print(x, "is the number you entered") This code first asks for the user's input then prints it with the string.
27th Apr 2018, 8:09 AM
Koketso Dithipe
Koketso Dithipe - avatar
+ 6
Print(Numer ur enter format(x) Then Result
16th May 2018, 3:13 PM
Sadaam Linux
Sadaam Linux - avatar
+ 3
Put a comma in between e.g. print(45, "this is...")
27th Apr 2018, 8:00 AM
Koushik Naskar
Koushik Naskar - avatar
+ 3
For more complex output purposes I would suggest you to use string formatting https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2455/
27th Apr 2018, 8:06 AM
Koushik Naskar
Koushik Naskar - avatar
+ 2
after the print statement, enter the variable, a comma, and the string in double quotes then you finish by closing them in a brackets. I.e print(y, "this is it")
2nd Jun 2018, 8:15 PM
Snr Oscar Ghitto
Snr Oscar Ghitto - avatar