how to create class in python...?
Answers
Answered by
0
Thomas Alva edition create class in python
Answered by
1
Answer:
class test:
def lol(self):
print("Test!")
test()
Explanation:
test can be replaced by anything and lol too. First we have to make a class assign some stuff for it to do and then call the function.
output
>>> test
you can also call a certain function in the class
for ex.
class test:
def lol(self):
print("test")
def lol2(self):
print("test2")
t = test()
t.lol2()
output
>>> test2
this is beacuse we called the second function in the class 'test', so the output is 'test2'.
hope it helped you
Similar questions