Skip to content

Instantly share code, notes, and snippets.

@dencorg
Last active October 21, 2017 08:18
Show Gist options
  • Save dencorg/9658fbee5b8ff76ad9c370287a1bd107 to your computer and use it in GitHub Desktop.
Save dencorg/9658fbee5b8ff76ad9c370287a1bd107 to your computer and use it in GitHub Desktop.
# δημιουργία κλάσης
class Vehicle:
def __init__(self, number_of_wheels, fuel_type, maximum_velocity):
self.number_of_wheels = number_of_wheels
self.type_of_tank = fuel_type
self.maximum_velocity = maximum_velocity
def make_noise(self):
print('VRUUUUUUUM')
tesla = Vehicle(4, 'electric', 250)
print(tesla.number_of_wheels)
class Vehicle:
def __init__(self, number_of_wheels, fuel_type, maximum_velocity):
self.number_of_wheels = number_of_wheels
self.type_of_tank = fuel_type
self.maximum_velocity = maximum_velocity
def get_number_of_wheels(self):
return self.number_of_wheels
def set_number_of_wheels(self, number):
self.number_of_wheels = number
bmw = Vehicle(4, 'petrol', 200)
bmw.set_number_of_wheels(2)
print(bmw.number_of_wheels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment