Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
variables.py
#python 3.5.2 #instance and static variables class Car: wheel=4#static varible,create ouside to all methods and inside the class def __init__(self,name,mil): self.name=name#instance variables defined inside __init__() #In this example name and mil self.mil=mil def car_details(self): print("Car details:\n",'Name ',self.name,'\n','Milege ',self.mil,'\n','Wheels ',Car.wheel) c1=Car('Audi','5kmph') c2=Car('BMW','6kmph') #c1.name='Volvo'#instance variables can be accessed outside __init__() method i.e those are not local to __init__() #Car.wheel=3 c1.car_details() c2.car_details() #note-instance variables must be called on object #but static variables can be called either by class name or object
run
|
edit
|
history
|
help
0
linearSearch.py
(P2) Ciągi 2 - mapowanie
abc1
isipadu kuboid
square cube function
Game3
Insertion Sort
string length
shuru10
Hello. Py