Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a python assignment. May I know whats wrong? Thanks! Print the circumference and area of the circle after user inputs the radius of
This is a python assignment. May I know whats wrong? Thanks!
Print the circumference and area of the circle after user inputs the radius of a circle. Do not use any input prompt. User may input any floating point number as the radius. Print the circumference and area up to 2 decimal places as shown in the example. (Note about rounding: In Lecture 2 we mentioned issues related to problems of accuracy of representation of floating point numbers, and specific rounding method by Python. However, for simplicity the test cases of this question DO NOT require you to solve such issues.) For example: Test Input Result 1 3 Circumference: 18.85 Area: 28.27 Answer: (penalty regime: 10, 20, ... %) Reset answer * 1 from math import pi 2 # You may use the variable pi in your code 3 x = float() 4 y = 2 * pi 5 z = pi (x ** 2) 6 print("Circumference: {: .2f}".format(y)) 7 Jprint("Area: {:.2f}".format(z)) Test Input Expected Got x 1 3 Circumference: 18.85- Area: 28.27 Circumference: 0.00 x Area: 0.00 x 2 2.2 Circumference: 13.82- Area: 15.21 Circumference: 0.00- x Area: 0.00 x 3 10 Circumference: 62.83- Area: 314.16 Circumference: 0.00- X Area: 0.00 X 4 72 Circumference: 452.39- Circumference: 0.00- Area: 16286.02 Area: 0.00Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started