Created
September 14, 2017 12:45
-
-
Save khayyamsaleem/cd7df6c54ad8929696f8a7027370eff3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is a calendar | |
from time import strftime, sleep | |
USER_FIRST_NAME = "Tristan" | |
calendar = {} | |
def welcome(): | |
print "Welcome " + USER_FIRST_NAME + "." | |
print "Calendar is opening...." | |
sleep(1) | |
print "Today is: " + strftime("%A %B %d, %Y") | |
print "Time right now is equal to: " + strftime("%H:%M:%S") | |
sleep(2) | |
print"What would you like to do?" | |
def start_calendar(): | |
welcome() | |
start = True | |
while start: | |
user_choice = raw_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 Empty." | |
else: | |
print calendar | |
elif user_choice == "U": | |
date = raw_input("What date?") | |
update = raw_input("Enter the update: ") | |
calendar[date] = update | |
print "Update was succesful!" | |
print calendar | |
event = raw_input("Enter event: ") | |
date = raw_input("Enter date (MM/DD/YYYY): ") | |
if len(date) > 10 or int(date[6:]) < int(strftime("%Y")): | |
print "Invalid date was entered..." | |
try_again = raw_input("Try again? Y for Yes, N for No: ") | |
try_again = try_again.upper() | |
else: | |
start = false | |
calendar[date] = event | |
print "Event successfully added" | |
print calendar | |
elif user_choice == "D": | |
if len(calendar.keys() < 1): | |
print "Calendar is empty" | |
else: | |
event = raw_input("What event?") | |
for date in calendar.keys(): | |
if event == calendar[date]: | |
del calendar[date] | |
print "The event was successfully deleted" | |
print calender | |
elif user_choice == "X": | |
start = False | |
else: | |
print "Invalid command was entered" | |
break | |
start_calendar() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment