I encountered some troubles in running my calendar


here is all my codes

  this is a command line calendar the user is able to 
View the calendar
Add an event to the calendar
Update an existing event
Delete an existing event
  the program should
  1.Print a welcome message to the user
  2.Prompt the user to view, add, update, or   3.delete an event on the calendar
  Depending on the user's input: view, add, update, or delete an event on the calendar
  4.The program should never terminate unless the user decides to exit
from time import sleep
from time import strftime

user_name = input("What is your name? ")

calendar = {}

def welcome():
    print("Welcome, " + user_name + ".")
    print("The calendar is opening...")
    "Today is" + strftime("%A %B %d %Y")
    "Current time is" + strftime("%H:%M:%S")
    print("What would you like to do?")

def start_calendar():
    start = True
    while start:
        user_choice = input("A to Add, U to Update, V to View, D to Delete, X to Exit: ")
        user_choice = user_choice.upper()
        if user_choice == 'V':
            if len(calendar.keys()) < 1:
                print("calendar is empty")
        elif user_choice == 'U':
            date = input("What date?")
            update = input("Enter the update: ")
            calendar[date] = update
            print("the update is successful")
        elif user_choice == 'A':
            event = input("Enter event: ")
            date = input("Enter date (MM/DD/YYYY): ")
            if (len(date) > 10 or int(date[6:]) < int(strftime("%Y"))):
                print("invalid message is entered")
                try_again = input("Try Again? Y for Yes, N for No: ")
                try_again = try_again.upper()
                if try_again == 'Y':
                    start = False
                calendar[date] = event
        elif user_choice == "D":
            if len(calendar.keys()) < 1:
                print("the calendar is empty")
                event = input("What event?")
                for date in calendar.keys():
                    if event == calendar[date]:
                        del (calendar[date])
                        print("the event is successfully deleted")

                        print(" an incorrect event was specified.")
        elif user_choice == "X":
            start = False
            print("invalid command was entered")


I did some modification to run in a python 3 IDE, however, it does not print out the current date and current time? I used pycharm as my IDE and it did not prompt me to leave my name either, it just showed a “?”


when doing what action?

i put your code here:



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.