Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Birthday Update index.html #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sonusingh99
Copy link

Birthday Manager Program

Dictionary to store birthdays

birthdays = {}

def add_birthday(name, date):
"""
Add a birthday to the dictionary.

:param name: Name of the person
:param date: Birthday date in the format 'YYYY-MM-DD'
"""
birthdays[name] = date

def check_birthday(date):
"""
Check if the given date is someone's birthday.

:param date: Date to check in the format 'YYYY-MM-DD'
:return: List of names who have their birthday on the given date
"""
birthday_people = [name for name, bday in birthdays.items() if bday == date]
return birthday_people

Example usage

if name == "main":
# Add some birthdays
add_birthday("Alice", "1995-01-12")
add_birthday("Bob", "2000-05-23")
add_birthday("Charlie", "1990-01-12")

# Check if today is someone's birthday
from datetime import datetime
today = datetime.today().strftime('%Y-%m-%d')

birthday_people = check_birthday(today)
if birthday_people:
    print(f"Today is the birthday of: {', '.join(birthday_people)}")
else:
    print("No birthdays today.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant