|
@@ -3,10 +3,19 @@ class Car:
|
|
model = "BMW"
|
|
model = "BMW"
|
|
engine = 1.6
|
|
engine = 1.6
|
|
|
|
|
|
|
|
+ def drive(self):
|
|
|
|
+ print("Let's go")
|
|
|
|
+
|
|
|
|
+
|
|
class Person:
|
|
class Person:
|
|
name = 'Ivan'
|
|
name = 'Ivan'
|
|
age = 30
|
|
age = 30
|
|
|
|
|
|
|
|
+def test_method():
|
|
|
|
+ car = Car()
|
|
|
|
+ getattr(car, 'drive')()
|
|
|
|
+
|
|
|
|
+
|
|
def teset_attr():
|
|
def teset_attr():
|
|
car = Car()
|
|
car = Car()
|
|
print(type(car))
|
|
print(type(car))
|
|
@@ -91,7 +100,8 @@ def main():
|
|
# teset_attr()
|
|
# teset_attr()
|
|
# test_attr_2()
|
|
# test_attr_2()
|
|
# print(test_attr_3(Car, 'model'))
|
|
# print(test_attr_3(Car, 'model'))
|
|
- test_attr_4()
|
|
|
|
|
|
+ # test_attr_4()
|
|
|
|
+ test_method()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
main()
|
|
main()
|