Demo entry 6745342



Submitted by anonymous on May 26, 2018 at 16:29
Language: Python. Code size: 603 Bytes.

class MyClass:
 Greeting = ""
 def __init__(self, Name="there"):
  self.Greeting = Name + "!"
 def SayHello(self):
  print("Hello {0}".format(self.Greeting))
testobject = MyClass()

class CrazyNumber(object):
  def __init__(self, n):
      self.n = n

  def __add__(self, other):
      return self.n - other

  def __sub__(self, other):
      return self.n + other

  def __str__(self):
      return str(self.n)

num = CrazyNumber(10)
print num 
print num + 10
print num - 5
print num

import glob

a = glob.glob('*.py')
print a

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).