Why do I need to write self
in this code despite it works?
But with my instructor, it didn't work and gave him an error mean that function doesn't take a parameter and you gave it one it happened when he took an object and he solved the error my placing self as an argument in open_door()
and close_door()
functions but the error didn't happen to me
class ferrari_2018():
color='red'
def open_door():
print('open door')
def close_door():
print('close door')
x=ferrari_2018
x.open_door()