Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
September 8th, 2013, 06:17 AM
 Veske
Registered User

Join Date: Sep 2013
Posts: 1
Time spent in forums: 31 m 31 sec
Reputation Power: 0
A beginners error

Hi!

So I am writing this code to find the superficies of a rectangle and after that I also want to paint the sayd rectangle and see how much paint it will take.

Now, I first did it so that the height and length we're in meteres and after that in the same program I did the same thing but with cm's.

Now when it gets to the cm part, it gives me an error:
Code:
```Leiame ristküliku pindala Kõrgus on: 3
Laius on: 3
Ristküliku pindala on:  9.0 m(ruudus)
Nüüd on meil vaja teada värvi kulu ühe ruutmeetri kohta
Värvi kulu: 3
Selle seina värvimiseks oleks vaja 3.0 liitrit värvi
Press ENTER to continue3
Kõrgus on: 3 Laius on: 3 Traceback (most recent call last):   File "C:/Users/Kaspar/Documents/Python/first.py", line 17, in <module>     print ("Ristküliku pindala on: ", P_m ,"m(ruudus)") TypeError: 'str' object is not callable```

And the code it self is here:
Code:
```print ("Leiame ristküliku pindala")
x = float(input("Kõrgus on: "))
y = float(input("Laius on: "))
P = x * y
print ("Ristküliku pindala on: ", P,"m(ruudus)")
print ("Nüüd on meil vaja teada värvi kulu ühe ruutmeetri kohta") z = float(input("Värvi kulu: "))
V = P / z
print ("Selle seina värvimiseks oleks vaja", V,"liitrit värvi")
wait = input("Press ENTER to continue")
print = ("Nüüd üritame sama ülesannet lahendada sentimeetrites.")
x_s = float(input("Kõrgus on: "))
y_s = float(input("Laius on: "))
x_m = x_s / 100 # Teisendan sentimeetri meetriks
y_m = y_s / 100 # Teisendan sentimeetri meetriks
P_m = x_m * y_m
print ("Ristküliku pindala on: ", P_m ,"m(ruudus)")
print ("Nüüd on meil vaja teada värvi kulu ühe ruutmeetri kohta") z_m = float(input("Värvi kulu: "))
V_m = P_m / z_m
print ("Selle seina värvimiseks oleks vaja", V_m,"liitrit värvi")
wait = input("Press ENTER to exit!")```

Now yes I have written the text in my native language but basicly y is height and x is width. P is the superficies of the rectangle and V is the amount of colour needed. x_m and so on are the same things but considered as the second part of the program when I enter things as cm and the program converts them it self.

Nvm, I had one print with a = .....

 Viewing: Dev Shed Forums > Programming Languages > Python Programming > A beginners error