-2

In Idle (Python 3.4.3) I'm trying to get it to print out the total (which it does) but then it won't do it with the statement "...is how many sweets you'll need." It just comes up with this message:

Non-Type object is not callable

This is what I'm typing in...

children = input ("How many children are there? ")
sweets = input ("How many sweets are there? ")
total = int(children)*int(sweets)
print (total) "is how many sweets you'll need"

How do I get it to display this statement after the total?!!

Any help greatly appreciated!

Kevin
  • 74,910
  • 12
  • 133
  • 166
Jamie123
  • 3
  • 1
  • 2
    possible duplicate of [How can I read inputs as integers in Python?](http://stackoverflow.com/questions/20449427/how-can-i-read-inputs-as-integers-in-python) – Morgan Thrapp Sep 14 '15 at 18:26

1 Answers1

2

The issue here is that in python 3, print is a function, not a keyword so you have created a syntax error with your print call. Though honestly what you've written would be a syntax error in python 2 also (but for different reasons).

You can modify the print call to work:

print(total, "is how many sweets you'll need")

Or you can format the string before you print it:

print("{0} is how many sweets you'll need".format(total))
Chad S.
  • 6,252
  • 15
  • 25