python - Error for fencing calculation program -


this question has answer here:

i aiming create program in python allows user input cost of fencing per meter, length , width of paddock , program should calculate , print perimeter , quoted price. have run few issues , research on stack overflow has unfortunately been unsuccessful. code follows (keep in mind beginner)

    turtle import* print ("welcome fencing quote calculator") print ("in program, able input size of padock cost of fence per meter") again = "" permetre = input(str(("please input cost per metre in numbers without dollar sign") width = input("please input width of paddock in metres") length = input("please input length of paddock in metres")  perimeter = (width+2) print ("the perimeter of paddock is",perimeter) cost = int((perimeter)*(permetre)) print("{:.2f}".format(cost)) 

the error typeerror: can't convert 'int' object str implicitly error code. if please explain in simple terms appreciate it. :)

please see comments in replacement code below.

from turtle import* print ("welcome fencing quote calculator") print ("in program, able input size of padock cost of fence per meter") again = "" permetre = input(str(("please input cost per metre in numbers without dollar sign") width = input("please input width of paddock in metres") length = input("please input length of paddock in metres")  # need convert "numbers" input strings floating point numbers permetre = float(permetre) width = float(width) length = float(length)  # fix perimeter equation? #perimeter = (width+2) perimeter = (width + length) * 2.0 print ("the perimeter of paddock is",perimeter) cost = perimeter * permetre print("{:.2f}".format(cost)) 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -