You are assigning to print
instead of using it as a function. Remove the =
, call the function instead:
print("Hi {}, You go to {} don't you". format (x,y))
Demo:
>>> x = input('Enter your Name : ')
Enter your Name : Martijn Pieters
>>> y = input('Enter your School : ')
Enter your School : Life
>>> print("Hi {}, You go to {} don't you". format (x,y))
Hi Martijn Pieters, You go to Life don't you
If you get a TypeError: 'str' object is not callable
exception, you still have local variable print
bound to a string; in an interactive Python session, simply delete that local variable:
del print
You’ll have to work your way through your homework yourself; put in a little effort yourself and give your teacher something to work with. We certainly won’t do your homework for you, what would be the point in that?
7
solved how to make print statement work in code give [closed]