Jan 15th, 2014
Price: $20 USD

Question description

In this exercise the idea is to build a notebook which applies the Python data structure list as a note manipulation method when the program is executed, and saves the data in a bitwise mode with pickle. The program has the following features:
A) It is possible to add notes, with similar timestamps as earlier. 
B)It is possible to edit a note by selecting it from the list, and rewriting it with new data.
C) It is possible to delete notes separately based on the selection and 
D) Notebook loads an existing notebook file from the file "notebook.dat" if such a file exists.

When the program starts, the system should check for a notebook datafile "notebook.dat" and load it with pickle. If no such file exists, or there was a problem with the file, a new file is created and the user is notified "No default notebook was found, created one.". After this the basic main menu works as in the earlier notebook:


import time  

import pickle 


def check(z):


  s1 = open("notebook.dat","rb")


  for i in contents:




 except IOError:

  print("No default notebook was found, created one.")

  s1 = open("notebook.dat","wb")



a= True



s1 = open(nm,"rb")


while a:

# print("Now using file ",nm)

 print("(1) Read the notebook\n(2) Add note\n(3) Edit a note \n(4) Delete a note \n(5) Save and quit")

 ch=int(input("Please select one: "))

 if ch==1:

  for i in mylist:



 elif ch==2:

   s2=input("Write a new note: ")


   s2+=time.strftime("%X %x")



 elif ch==3:

   print("The list has ",len(mylist)," notes.")

   chh=int(input("Which of them will be changed?: "))


   s22=input("Give the new note: ")


   s22+=time.strftime("%X %x")


 elif ch==4:


   print("The list has ",len(mylist)," notes.")

   chh=int(input("Which of them will be deleted?: "))

   print("Deleted note ",mylist[chh]) 



 elif ch==5:

  # print(mylist)


   s1 = open("notebook.dat","wb")




   print("Notebook shutting down, thank you.")



Tutor Answer

(Top Tutor) kukistars
School: Carnegie Mellon University

Studypool has helped 1,244,100 students

Review from student
" Thanks, good work "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1819 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors