GGORG revised this gist . Go to revision
No changes
GGORG revised this gist . Go to revision
1 file changed, 26 insertions
main.py(file created)
| @@ -0,0 +1,26 @@ | |||
| 1 | + | class Wagonik: | |
| 2 | + | def __init__(self): | |
| 3 | + | self.miejsca = [] | |
| 4 | + | self.nastepny = None | |
| 5 | + | ||
| 6 | + | def dodaj_pasazerow(self): | |
| 7 | + | pass | |
| 8 | + | ||
| 9 | + | def pokaz_pasazerow(self): | |
| 10 | + | if len(self.miejsca) == 0: | |
| 11 | + | print("Nikogo nie ma") | |
| 12 | + | else: | |
| 13 | + | print(self.miejsca) | |
| 14 | + | ||
| 15 | + | ||
| 16 | + | wagonik1 = Wagonik() | |
| 17 | + | wagonik2 = Wagonik() | |
| 18 | + | wagonik3 = Wagonik() | |
| 19 | + | ||
| 20 | + | wagonik1.nastepny = wagonik2 | |
| 21 | + | wagonik2.nastepny = wagonik3 | |
| 22 | + | ||
| 23 | + | wagonik1.nastepny.pokaz_pasazerow() | |
| 24 | + | ||
| 25 | + | ile_wagonikow = 1 | |
| 26 | + | # w domu: policzyc wszystkie wagoniki | |
Newer
Older