We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41f4648 commit e11eeb0Copy full SHA for e11eeb0
OOPS.py
@@ -0,0 +1,27 @@
1
+class Human:
2
+ # attributes
3
+ def __init__(self, name, height, weight):
4
+ self.name = name
5
+ self.height = height
6
+ self.weight = weight
7
+
8
+ # behaviours
9
+ def eating(self, food):
10
+ return ("{} is eating {}".format(self.name, food))
11
12
13
+# creating objects
14
+ram = Human("Ram", 6, 60)
15
+praveen = Human("Praveen", 5.9, 56)
16
+arun=Human("Arun",6.0,50)
17
18
+# printing object information
19
+print("Height of {} is {}".format(ram.name, ram.height))
20
+print("Weight of {} is {}".format(ram.name, ram.weight))
21
+print(ram.eating("Pizza"))
22
+print("Weight of {} is {}".format(praveen.name, praveen.height))
23
+print("Weight of {} is {}".format(praveen.name, praveen.weight))
24
+print(praveen.eating("Banana"))
25
+print("Weight of {} is {}".format(arun.name, arun.height))
26
+print("Weight of {} is {}".format(arun.name, arun.weight))
27
+print(arun.eating("Rice"))
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments