Обновить u5/kindergarten_garden.py
This commit is contained in:
parent
35ca1f28f2
commit
4143e6ed85
@ -1,15 +1,17 @@
|
||||
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 = [
|
||||
"Alena", "Boris", "Cyril", "Daniel", "Eva", "František",
|
||||
"Gitka", "Helena", "Ivana", "Jozef", "Karol", "Ladislav",
|
||||
]
|
||||
def add_rows(self,row):
|
||||
if isinstance(row,str):
|
||||
raise ValueError("Row has to be string")
|
||||
self.rows.append(row)
|
||||
|
||||
PLANTS = {
|
||||
"G": "Tráva",
|
||||
"C": "Ďatelina",
|
||||
"R": "Reďkovky",
|
||||
"V": "Fialky",
|
||||
}
|
||||
garden = Garden("VVCG\nWRC")
|
||||
print([item[1:3] for item in garden.rows])
|
||||
garden.rows.append(Garden("s\ns"))
|
||||
print(garden.rows)
|
||||
Loading…
Reference in New Issue
Block a user