Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pp1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
anjanadevi.s
Pp1
Commits
da13fcdd
Commit
da13fcdd
authored
Nov 03, 2020
by
Anjanadevi95
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Rectangle.py
Referenec
parents
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
Rectangle.py
Rectangle.py
+21
-0
No files found.
Rectangle.py
0 → 100644
View file @
da13fcdd
import
math
class
circle
():
#_init_used to initialize values of class
def
__init__
(
self
,
radius
):
self
.
radius
=
radius
#Method c_area to calculate the area of the circle
def
c_area
(
self
):
return
math
.
pi
*
(
self
.
radius
**
2
)
#Method c_perimeter to calculate the perimeter of the circle
def
c_perimeter
(
self
):
return
2
*
math
.
pi
*
self
.
radius
#Take the input from the user
r
=
int
(
input
(
"Enter radius of circle: "
))
#An object for class is created
obj
=
circle
(
r
)
#Using object,area mehod is called
print
(
"Area of circle:"
,
round
(
obj
.
c_area
(),
2
))
#Using object,Perimeter method is called
print
(
"Perimeter of circle:"
,
round
(
obj
.
c_perimeter
(),
2
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment