Jul-15-2020, 11:53 AM
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.
But, I'm trying to implement the following:
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
I've managed the following very basic setup:
This is basically how it should work with the given parameters.
1 2 3 4 5 6 7 |
>>> 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:
1 2 3 4 5 6 7 8 9 10 11 12 |
>>> 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