from notebook import NoteBook from notebook import Note quote_book = NoteBook("The Quote Book") new_note = Note() new_note.write_content( "Don't cry because it's over smile because it happened. -Dr.Seuss") quote_book.add_note(new_note) print(quote_book.get_number_of_pages()) quote_book.add_note(Note("Hello, World1")) quote_book.add_note(Note("Hello, World2")) quote_book.add_note(Note("Hello, World3")) quote_book.add_note(Note("Hello, World4")) quote_book.add_note(Note("Hello, World5")) print(quote_book.get_number_of_pages()) my_note = quote_book.remove_note(1) print(my_note) print(quote_book.get_number_of_pages())
from notebook import Note from notebook import NoteBook sentence1 = "hi" note1 = Note(sentence1) sentence1 = "hello" note2 = Note(sentence1) sentenct1 = "how are you?" note3 = Note(sentence1) print(note1) note1.remove() print(note1) sentence2 = NoteBook("대화") sentence2.add_note(note1) sentence2.add_note(note2) print(sentence2.get_number_of_pages()) sentence2.add_note(note1, 100) for i in range(300): sentence2.add_note(note1, i) print(sentence2.get_number_of_pages())
# class 활용 예제 from notebook import NoteBook from notebook import Note new_note = Note() new_note.write_content("Don't cry. because I'm happy") quote_book = NoteBook("The Quote Book") quote_book.add_note(new_note) quote_book.add_note(new_note) quote_book.add_note(new_note) quote_book.add_note(new_note) quote_book.add_note(new_note) print(quote_book.get_number_of_pages()) # quote_book.add_note(Note("Hellow, world")) # quote_book.add_note(Note("Hellow, world")) # quote_book.add_note(Note("Hellow, world")) # print(quote_book.get_number_of_pages()) my_note = quote_book.remove_note(10) print(my_note) # my_note = quote_book.remove_note(1) # print(my_note)
print(note_1) note_1.remove() print(note_1) good_sentence = """삶이 있는 한 희망은 있다. - 키케로 """ note_2 = Note(good_sentence) good_sentence = """하루에 3시간을 걸으면 7년 후에 지구를 한 바퀴 돌 수 있다. - 사무엘 존슨""" note_3 = Note(good_sentence) good_sentence = """행복의 문이 하나 닫히면 다른 문이 열린다. 그러나 우리는 종종 닫힌 문을 멍하니 바라보다가 우리를 향해 열린 문을 보지 못하게 된다. - 헬렌 켈러""" note_4 = Note(good_sentence) wise_saying_notebook = NoteBook("명언 노트") wise_saying_notebook.add_note(note_1) print(wise_saying_notebook.get_number_of_all_pages()) wise_saying_notebook.add_note(note_2) print(wise_saying_notebook.get_number_of_all_pages()) wise_saying_notebook.add_note(note_3) wise_saying_notebook.add_note(note_4) print(wise_saying_notebook.get_number_of_all_pages()) print(wise_saying_notebook.get_number_of_all_characters()) wise_saying_notebook.remove_note(3) print(wise_saying_notebook.get_number_of_all_pages()) wise_saying_notebook.add_note(note_1, 100) wise_saying_notebook.add_note(note_1, 100)