Indentation error


#1

this is in the lesson command line calendar
here is my code

from time import sleep, strftime
USER_FIRST_NAME = "Tony"

calendar = {}

def welcome():
  print("Welcome, ") + USER_FIRST_NAME + "."
  print("The calendar is opening...")
  sleep(1)
  print "Today is" + strftime("%A %B %d %Y")
  print "Current time is" + strftime("%H %M %S")
  sleep(1)
  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 is empty")
    elif user_choice == 'U':
      date = raw_input("What date?")
      update = raw_input("Enter the update: ")
      calendar[date] = update
      print("the update is successful")
      print(calendar)
		elif user_choice == 'A':
      event = raw_input("Enter event: ")
      date = raw_inout("Enter date (MM/DD/YYYY): ")
			if len(date) > 10 or int(date[6:9]) < int(strftime("%Y")):

I suppose I should give three tab for the last line of the code(one for the function, one for the elif then one for if statement itself, why the terminal keep telling me there was an indentation error in the last line of the code(the if statement).


#2

Here I can see a indentation problem with elif == ‘A’ , but it was fine in the lesson. It turned wrong after I copied it.


#3

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