I know it may sound foolish but can anyone explain in detail why both the print functions are giving different output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I know it may sound foolish but can anyone explain in detail why both the print functions are giving different output?

Code:- x=input("enter x") print(x) print(x)

4th Mar 2017, 3:46 AM
Nishchay
2 Answers
+ 6
They are giving the same output except that in the first line it's printing 'enter x' and then the value of x and in the second line only the value of x was printed. Visit this link to understand how to do line breaks in Python: http://stackoverflow.com/questions/53162/how-can-i-do-a-line-break-line-continuation-in-python
4th Mar 2017, 4:24 AM
Chirag Bhansali
Chirag Bhansali - avatar
0
I just tried your code and I got the same output as expected
4th Mar 2017, 4:23 AM
Alejandro Serrato
Alejandro Serrato - avatar