I'm new to python and I wanted to know why my program is not working. The error is "IndexError: list index out of range" for line 23 (This program is for my best friend's birthday that's tomorrow)
import datetime
import tkinter
from tkinter import *
t = Tk()
t.resizable(0, 0)
t.title("Sana's birthday!!!")
t.geometry('200x200')
current_date = datetime.date.today().strftime('%Y-%m-%d')
current_date_lst = current_date.split('-')
l1 = Label(t, text='Sana enter your birthday in yyyy-mm-dd format:').grid(row=1, column=1)
l2 = Label(t, text='Name of your birthday legend?:').grid(row=2, column=1)
b_date = tkinter.Entry(t)
b_date.grid(row=1, column=2)
name = tkinter.Entry(t)
name.grid(row=1, column=2)
b_date = b_date.get().split( '-' )
if current_date_lst[1] == b_date[1] and current_date_lst[2] == b_date[2]:
age = int(current_date_lst[0]) - int(b_date[0])
ordinal_suffix = {1: 'st', 2:'nd', 3:'rd', 11:'th', 12:'th', 13:'th'}.get(age % 10 if not 10<age<=13 else age % 14, 'th')
print(f" It's {name}'s {age}{ordinal_suffix} Birthday!")
else:
print('Sorry, today is not your birthday:(')
mainloop()
The error:
if current_date_lst[1] == b_date[1] and current_date_lst[2] == b_date[2]:
IndexError: list index out of range