Q1. Find the output for the following
1
Dim area, radius, pias integer
pi= 3.14
radius=10
area=pi*radius radius
Print area
Answers
Explanation:
Write a Python program which accepts the radius of a circle from the user and compute the area.
Python: Area of a Circle
In geometry, the area enclosed by a circle of radius r is πr2. Here the Greek letter π represents a constant, approximately equal to 3.14159, which is equal to the ratio of the circumference of any circle to its diameter.
Python: Area of a circle
Sample Solution:-
Python Code:
from math import pi
r = float(input ("Input the radius of the circle : "))
print ("The area of the circle with radius " + str(r) + " is: " + str(pi * r**2))
Copy
Sample Output:
Input the radius of the circle : 1.1
The area of the circle with radius 1.1 is: 3.8013271108436504
Flowchart:
Flowchart: Input the radius of a circle and compute the area.
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to display the current date and time.
Next: Write a Python program which accepts the user's first and last name and print them in reverse order with a space between them.
What is the difficulty level of this exercise?
EASY MEDIUM HARD
Based on 1004 votes, average difficulty level of this exercise is Easy .
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Python: Memory Footprint Of An Object
import sys
x = 'farhadmalik'
print(sys.getsizeof(x))
60
New Content published on w3resource :
Python Numpy exercises
Python GeoPy Package exercises
Python Pandas exercises
Python nltk exercises
Python BeautifulSoup exercises
Form Template
Composer - PHP Package Manager
PHPUnit - PHP Testing
Laravel - PHP Framework
Angular - JavaScript Framework
React - JavaScript Library
Vue - JavaScript Framework
Jest - JavaScript Testing Framework
by TaboolaSponsored LinksYou May Like
Born Between 1965-1985? Get Term Life Insurance Worth ₹1 Cr at Rs.1884/month*.
Term Plans -Compare & Buy Now!
Own the Galaxy Note20 series at ₹63999*
Samsung Galaxy Note20
Do You Speak English? Work a USA job from home in India
Work from Home | Search Ads
Cyber Security Courses Online Might Be Easier Than You Think
Cyber Security | Search Ad
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
©w3resource.com 2011-2020
PrivacyAboutContactFeedbackAdvertise