|
|
|
```python
|
|
|
|
class Student:
|
|
|
|
def __init__(self, name, age):
|
|
|
|
self.name = name
|
|
|
|
self.age = age
|
|
|
|
self.knowledge = 0
|
|
|
|
|
|
|
|
def study(self):
|
|
|
|
self.age += 1
|
|
|
|
self.knowledge += 1
|
|
|
|
|
|
|
|
def write_thesis(self):
|
|
|
|
if self.knowledge >= 5:
|
|
|
|
return 'Good work!'
|
|
|
|
else:
|
|
|
|
return 'Keep studying'
|
|
|
|
```
|
|
|
|
|
|
|
|
### Naming conventions
|
|
|
|
* Class names should be came lcase: ```MyClassName```
|
|
|
|
* Function/Method/Variable names should be snake case: ```my_function_name```
|
|
|
|
|
|
|
|
**see also the [PEP-8](https://www.python.org/dev/peps/pep-0008/) Python style guide**
|
|
|
|
|
|
|
|
### The ```__init__```
|
|
|
|
* function is called as soon as the class is instantiated (you create an object of it)
|
|
|
|
* all * self-variables* should be initiated here
|
|
|
|
|