diff --git a/10 Using Data and Time/exercise-01.py b/10 Using Data and Time/exercise-01.py index eebc092..967abff 100644 --- a/10 Using Data and Time/exercise-01.py +++ b/10 Using Data and Time/exercise-01.py @@ -1,2 +1,28 @@ import time +def get_birth_date(): + """Prompts the user for year, month, and day as integers.""" + year = int(input("Enter birth year (e.g., 1997): ")) + month = int(input("Enter birth month (1-12): ")) + day = int(input("Enter birth day (1-31): ")) + return year, month, day + +def display_birth_info(year, month, day): + """Converts the input integers to a time structure and displays formatted output.""" + date_tuple = (year, month, day, 0, 0, 0, 0, 0, -1) + + parsed_time = time.struct_time(date_tuple) + + seconds = time.mktime(parsed_time) + formatted_struct = time.localtime(seconds) + + # Format date string as DD/Mon/YY (e.g., 15/Jan/97) + formatted_date = time.strftime("%d/%b/%y", formatted_struct) + + day_of_week = time.strftime("%A", formatted_struct) + + print(f"\nDate entered: {formatted_date}") + print(f"You were born on a {day_of_week}.") + +year, month, day = get_birth_date() +display_birth_info(year, month, day) \ No newline at end of file diff --git a/11/exercise-01.py b/11/exercise-01.py new file mode 100644 index 0000000..c165178 --- /dev/null +++ b/11/exercise-01.py @@ -0,0 +1,19 @@ +STARTERS = ["Tomato Soup", "Baked Camembert", "Prawn Cocktail", "Garlic Butter Mushrooms"] +MAINS = ["Chicken Tikka Masala", "Beef Stew", "Chicken Parmesan", "Chicken Curry"] +DESSERTS = ["Chocolate Cake", "Ice Cream", "Lemon Meringue Pie", "Cheesecake"] +DRINKS = ["Coffee", "Tea", "Water", "Lemonade"] + +import random + +starter = random.choice(STARTERS) +main = random.choice(MAINS) +dessert = random.choice(DESSERTS) +drink = random.choice(DRINKS) + +print("***************************") +print(" MENU") +print(f"Starter: {starter}") +print(f"Main : {main}") +print(f"Dessert: {dessert}") +print(f"Drinks : {drink}") +print("***************************") \ No newline at end of file diff --git a/11/image.png b/11/task.png similarity index 100% rename from 11/image.png rename to 11/task.png diff --git a/12/exercise-01.py b/12/exercise-01.py new file mode 100644 index 0000000..d079c8f --- /dev/null +++ b/12/exercise-01.py @@ -0,0 +1,8 @@ +# regular octagon in red +# regular nonagon in blue + +# condition controlled iteration +# both shapes on same screen + +import turtle + diff --git a/12/image.png b/12/task.png similarity index 100% rename from 12/image.png rename to 12/task.png