[Tutor] Python input function not working in 2.7 version

Morten Engvoldsen mortenengv at gmail.com
Wed Oct 24 13:15:11 CEST 2012

I am facing issue with input() of Python 2.7. When i run the program it
doesn't display any line to take user input . Below is the code:

def user_input()
   fat_grams = input("How many grams of fat are in one serving? ")
   total_calories = input("How many total calories are in one serving? ")
   print("A food product having {0} fat grams and {1} total

def main():
   if __name__ == "__main__": main()

Also i would like to display fat_grams where {0} place holder is there and
total_calories where {1} place holder is there.
That is if :
fat_grams = 3
total_calories = 270

Output should be: A food product having 3 fat grams and 270 total calories.

But the above print function doesn't display the out put in same way. I am
new to Python and i appreciate your help in advance.

Look forward to hear from your team soon and have a nice day.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121024/26e92798/attachment.html>

More information about the Tutor mailing list