Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Write a program that reads the radius of a circle in centimetres and shows its area, with . What does it show for a radius of ?
Area of a circle is pi times radius times radius.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. Read the radius as a float, calculate, and round.
radius = float(input("Radius in cm: "))area = 3.14 * radius * radiusprint("Area:", round(area, 2), "square cm")Check. .
Answer: square centimetres.
Log in to join the discussion.
Loading…