Search code examples
pythoncallable

'int' object is not callable for python 3.2


Okay, so I am very new to programming. I've started teaching myself python-3.2, and am attempting to write a program which shows what any restaurant bill would be with a 15% tip and a 20% tip. I keep on getting:

Traceback (most recent call last):   
  File "/home/marian/restaurantbilltotal.py", line 6, in <module>     
    print(fifteen ("Plus a 15% tip: "))
TypeError: 'int' object is not callable tip

The code I have written is:

#Restaurant bill total

bill = int(input("Restaurant bill total: "))

fifteen = (bill // 100) * 15 + bill
print(fifteen ("Plus a 15% tip: "))

twenty = (bill // 100) * 20 + bill
print(twenty ("Plus a 20% tip: "))

input("\n\nPress the enter key to exit.")

Please help, but keep in mind I've only just started to learn how to programme :-). Thanks.


Solution

  • bill = int(input("Restaurant bill total: "))
    
    fifteen = (bill * 0.15)
    
    twenty = (bill * 0.20)
    
    print("Your Actual bill : ", bill)
    print("Bill with 15% additional charge : ", bill+fifteen)
    print("Bill with 20% additional charge : ", bill+twenty)
    
    input("\n\nPress the enter key to exit.")