Обновить u5/kindergarten_garden.py
This commit is contained in:
parent
35ca1f28f2
commit
4143e6ed85
@ -1,15 +1,17 @@
|
|||||||
class NoSuchStudentException(Exception):
|
class NoSuchStudentException(Exception):
|
||||||
"""Vyvolá sa, ak žiak nie je v zozname žiakov záhona."""
|
"""Žiak nie je v zozname."""
|
||||||
|
|
||||||
|
class Garden():
|
||||||
|
def __init__(self, diagram: str):
|
||||||
|
self.diagram: str = diagram
|
||||||
|
self.rows: str = diagram.splitlines()
|
||||||
|
|
||||||
DEFAULT_STUDENTS = [
|
def add_rows(self,row):
|
||||||
"Alena", "Boris", "Cyril", "Daniel", "Eva", "František",
|
if isinstance(row,str):
|
||||||
"Gitka", "Helena", "Ivana", "Jozef", "Karol", "Ladislav",
|
raise ValueError("Row has to be string")
|
||||||
]
|
self.rows.append(row)
|
||||||
|
|
||||||
PLANTS = {
|
garden = Garden("VVCG\nWRC")
|
||||||
"G": "Tráva",
|
print([item[1:3] for item in garden.rows])
|
||||||
"C": "Ďatelina",
|
garden.rows.append(Garden("s\ns"))
|
||||||
"R": "Reďkovky",
|
print(garden.rows)
|
||||||
"V": "Fialky",
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user