Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!
class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return 'hello world'
class Weapon:
damage = 20
ammo = 80
clip = 8
name = "Example Weapon"
icon = "pic/example.png"
x = Weapon()def __init__(self,name,damage,clip,ammo,icon):
self.name = name
self.damage = damage
self.clip = clip
self.ammo = ammo
self.icon = icon
x = Weapon("Colt 1911", 20, 8, 80, "pic/Colt1911.png")
print x.name
Colt 1911Source: https://docs.python.org/2/tutorial/classes.html
Classes are like data structures which make it easier to store informations.
An example class in python taken from the page: