+ 1
Class in python
Hi there, I have one task, to write the Class(), which represent Zettelkasten. Each notice must have title, text , and id_number. The notices have the order 1,2,3,4,.... and for example the notice 2 can have children 2a, 2b, 2c, 2d and 1b (the letter can have the next order a,b,c,..., y,z, aa,ab, ac, ay, az, ba). Unfortunately I am beginner in classes and I don’t understand what I need to build this class. Can someone help me? class Zettel(): def __init__(self, title, text): self.title=title self.text= text self.id_num= 1
1 ответ
0
Here an example using a base class as both, the box and each notice contain a collection of notices. So the shared part is there.
As a notice contains notices we get as many levels as necessary. Per level an indicator (useNum) gets switched to identify if we generate shall numbers or characters. When characters are used we loop the number until we have enough characters to represent it.
https://code.sololearn.com/c0JNE5XvVZfM/?ref=app