forked from dataman-git/codes_for_articles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVeryCool.py
31 lines (24 loc) · 761 Bytes
/
VeryCool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## OOP
class cookie():
def __init__(self, r,flavor):
self.radius = r
self.theFlavor = flavor
def area(self):
return 3.1416 * self.radius * self.radius
def perimeter(self):
return 2 * 3.1416 * self.radius
if __name__ == "__main__":
smallCookie = cookie(3,'rasin')
largeCookie = cookie(10,'chocolate')
# smallCookie
print("My small cookie is a " + smallCookie.theFlavor + " cookie.")
print("It's area is: ")
print(smallCookie.area())
print("And it's perimeter is: ")
print(smallCookie.perimeter())
# largeCookie
print("My large cookie is a " + largeCookie.theFlavor + " cookie.")
print("It's area is: ")
print(largeCookie.area())
print("And it's perimeter is: ")
print(largeCookie.perimeter())