Skip to content

Instantly share code, notes, and snippets.

@masayang
Created October 5, 2012 01:35
Show Gist options
  • Save masayang/3837559 to your computer and use it in GitHub Desktop.
Save masayang/3837559 to your computer and use it in GitHub Desktop.
関数とクラス
class Stuffy(object):
def __init__(self, s = None):
self.buffer = s
def eek(self):
return self.buffer
if __name__ == '__main__':
s1 = Stuffy(10)
s2 = Stuffy(20)
print s1.eek()
print s2.eek()
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
if __name__ == '__main__':
print factorial(10)
print factorial(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment