Kalender.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. class calender:
  2. def __init__(self, date, time, name, location):
  3. self.date = date
  4. self.time = time
  5. self.name = name
  6. self.location = location
  7. def appointment(self):
  8. with open("calendar.txt", "a") as f:
  9. f.write(f"Termin: Name: {self.name} | ")
  10. f.write(f"Date: {self.date} | ")
  11. f.write (f"Time: {self.time} | ")
  12. f.write(f"Location: {self.location}\n")
  13. f.writable()
  14. with open("calendar.txt", "r") as f:
  15. print(f.read())
  16. while True:
  17. option = input("What do you want to do? (check [1], add appointment [2], update appointment [3], exit): ")
  18. if option == "1":
  19. f = open("calendar.txt")
  20. print(f.read())
  21. elif option == "2":
  22. name = input("Insert the Name ")
  23. date = input("Insert Date ")
  24. time = input("Insert Time ")
  25. location = input("Insert Location ")
  26. new_appointment = calender(date, time, name, location)
  27. new_appointment.appointment()
  28. elif option == "3":
  29. print("WiP")
  30. elif option == "exit":
  31. print("exiting...")
  32. break
  33. else:
  34. print("Unvalid input. ")