Skip to content

Instantly share code, notes, and snippets.

@rahulkp220
Created April 22, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulkp220/512583632fe8f28c2241c9f4688747fa to your computer and use it in GitHub Desktop.
Save rahulkp220/512583632fe8f28c2241c9f4688747fa to your computer and use it in GitHub Desktop.
import math
class A(object):
cursur = 0.0
def __init__(self,x,y):
self.x = x
self.y = y
def move_forward(self,x,y):
x+=1
y+=1
A.cursur += math.sqrt(x**2 + y**2)
return “New location after moving forward is ({}, {})”.format(x,y)
@staticmethod
def cube(*args):
return “Cube is {}”.format(sum([i**2 for i in list(args)]))
@classmethod
def get_cursor_location(cls):
return “New cursor location is {}”.format(cls.cursur)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment