real python oop
>>> class Dog:
... pass
...
>>> a = Dog()
>>> type(a)
<class '__main__.Dog'>
real python oop
>>> class Dog:
... pass
...
>>> a = Dog()
>>> type(a)
<class '__main__.Dog'>
python how to use oop
#Object oriented programming is when you create your own custom class.
#One reason you should do this is that is saves you time.
#Another reason is it makes calling certain functions easier with tkinter
class Dog:
#init creates certain parameters that allow you to define information quickly.
def __init__(self, name):
self.name = name
def get_name(self):
return self.name
if __name__ == "__main__":
d = Dog(str(input("name your dog: "))
print(d.get_name())
oops in python
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us