• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión60bc2c6410936d9ce70295ef7a7328263a488327 (tree)
Tiempo2007-08-05 00:38:59
Autoriselllo
Commiteriselllo

Log Message

I added object2.py which is a very simple code calculating the area of a
rectangle using classes and instantiation.

Cambiar Resumen

Diferencia incremental

diff -r 75ac6881efda -r 60bc2c641093 Python-codes/object2.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Python-codes/object2.py Sat Aug 04 15:38:59 2007 +0000
@@ -0,0 +1,17 @@
1+#! /usr/bin/env python
2+
3+"""square.py -- Make some noise about a square."""
4+
5+class rectangle:
6+ def __init__(self, height, width):
7+ self.height = height
8+ self.width = width
9+
10+ def area(self):
11+ return self.height * self.width
12+
13+
14+my_rect=rectangle(5.,4.)
15+print 'the width is ', my_rect.width
16+print 'the height', my_rect.height
17+print 'the area is', my_rect.area()
\ No newline at end of file