Q. Consider the following code:
name = input('What is your name? ')
print ('Hi', name, ',')
print ('How are you doing? ')
was intended to print output as
Hi <name>, How are you doing?
But it is printing the output as:
Hi <name>,
How are you doing?
What could be the problem? Can you suggest the solution for the same?
Answer =
Problem is that second print statement print the code in newline
Correct way:-
name = input('What is your name? ')
print ('Hi', name, ',','How are you doing? ')
print ("Hello " + name + " How are you doing")
ReplyDeleteThis is also correct.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )