0% found this document useful (0 votes)
11 views2 pages

Making Notes In Python Code

The document outlines a Python class for a note-taking application that allows users to create, view, edit, delete, and list notes. It includes methods for each functionality and a run method that provides a user interface for interaction. The application stores notes in a dictionary with titles as keys and content as values.

Uploaded by

hlmg375
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Making Notes In Python Code

The document outlines a Python class for a note-taking application that allows users to create, view, edit, delete, and list notes. It includes methods for each functionality and a run method that provides a user interface for interaction. The application stores notes in a dictionary with titles as keys and content as values.

Uploaded by

hlmg375
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Making Notes In Python Code

class NotetakingApp:

def __init__(self):

self.notes = {}

def create_note(self):

title = input("Enter the title of the note: ")

content = input("Enter the content of the note: ")

self.notes[title] = content

print("Note created successfully!")

def view_note(self):

title = input("Enter the title of the note to view: ")

if title in self.notes:

print("Title: ", title)

print("Content: ", self.notes[title])

else:

print("Note not found!")

def edit_note(self):

title = input("Enter the title of the note to edit: ")

if title in self.notes:

new_content = input("Enter the new content of the note: ")

self.notes[title] = new_content

print("Note edited successfully!")

else:

print("Note not found!")

def delete_note(self):

title = input("Enter the title of the note to delete: ")

if title in self.notes:

del self.notes[title]

print("Note deleted successfully!")

else:

print("Note not found!")


def list_notes(self):

print("List of notes:")

for title in self.notes:

print(title)

def run(self):

while True:

print("\nNote-taking App")

print("1. Create a note")

print("2. View a note")

print("3. Edit a note")

print("4. Delete a note")

print("5. List all notes")

print("6. Quit")

choice = input("Enter your choice: ")

if choice == "1":

self.create_note()

elif choice == "2":

self.view_note()

elif choice == "3":

self.edit_note()

elif choice == "4":

self.delete_note()

elif choice == "5":

self.list_notes()

elif choice == "6":

break

else:

print("Invalid choice. Please try again.")

if __name__ == "__main__":

app = NotetakingApp()

app.run()

You might also like