Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Property price calculation
#1
Hi. I'm a beginner stuck with a problem and need help please. I need to calculate the total property size ( width and length ) and then the total cost of the property. I need to print the final property sum in the shell

I've managed the following very basic setup:
This is basically how it should work with the given parameters.
>>> length = 15
>>> width = 10
>>> price = 8.99
>>> total_m2 = length * width
150
>>> print(total * price)
1348.5


But, I'm trying to implement the following:
>>> squaremeters = "m2"
>>> euro = "€"
>>> length = 15
>>> width = 10
>>> price = euro + str(8.99) + squaremeters
'€8.99m2'
>>> totalm2 = length * width
150
>>> total_m2 = str(totalm2) + squaremeters
'150m2'
>>>print = (total_m2 * price)   
TypeError: can't multiply sequence by non-int of type 'str'


I've tried using multiple data types, but i keep getting the same or similar error. Is it just not possible or have I gone completely off the beaten track here? So confused!

Thanks in advance
Reply


Messages In This Thread
Property price calculation - by oli_action - Jul-15-2020, 11:53 AM
RE: Property price calculation - by palladium - Jul-15-2020, 12:08 PM
RE: Property price calculation - by oli_action - Jul-15-2020, 02:08 PM
RE: Property price calculation - by snippsat - Jul-15-2020, 02:40 PM
RE: Property price calculation - by sridhar - Jul-15-2020, 04:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Finding the price based on industry and number of transactions chandramouliarun 0 958 Jul-26-2022, 07:36 PM
Last Post: chandramouliarun
  Subclass initialized property used in parent class method. Is it bad coding practice? saavedra29 5 1,953 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  class - calculate total price of copies 3lnyn0 1 1,622 Dec-12-2021, 11:43 PM
Last Post: BashBedlam
Exclamation Invalid syntax error(Predict Ethereum Price) lulu43366 2 3,261 Sep-24-2021, 01:24 PM
Last Post: lulu43366
  ABC Module and @property decorator, Pythonic Way? muzikman 21 5,957 Aug-18-2021, 06:08 PM
Last Post: muzikman
  @property vs __set__ / __get__ and __setattr__ / __getattr__ okhajut 1 3,443 Jun-15-2021, 03:48 PM
Last Post: snippsat
  An important question is how to create a zigzag in price data? epsilon 0 1,340 Nov-18-2020, 08:06 PM
Last Post: epsilon
  Can property getters and setters have additional arguments? pjfarley3 2 3,126 Oct-30-2020, 12:17 AM
Last Post: pjfarley3
  Use of @property decorator ruy 16 6,836 Jun-09-2020, 05:29 PM
Last Post: buran
  Problem adding keys/values to dictionary where keynames = "property" and "value" jasonashaw 1 2,108 Dec-17-2019, 08:00 PM
Last Post: jasonashaw

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020