6
I need to write a program that reads values and then use them to calculate areas of different geometric figures. My problem is: how to enter the data on the same line? Example: 3.0 4.0 2.0 followed by calculation in the next line
How to write code for Python to read on the same line? It’s really with raw_input?
Like I’m doing:
a = float(raw_input())
b = float(raw_input())
c = float(raw_input())
triangulo = (a * c) / 2
print "TRIANGULO:", ("%.3f" % triangulo)
circulo = (3.14159 * c**2 )
print "CIRCULO:", ("%.3f" % circulo)
trapezio = ((a + b) * c) / 2
print "TRAPEZIO:", ("%.3f" % trapezio)
quadrado = b * b
print "QUADRADO:", ("%.3f" % quadrado)
retangulo = a * b
print "RETANGULO:", ("%.3f" % retangulo)
Take a look at this Link.
– Solkarped