From 685f7698069805a24088e645b565ef4119d2c43a Mon Sep 17 00:00:00 2001 From: Abhilash Date: Wed, 23 Apr 2025 03:58:25 +0530 Subject: [PATCH 1/2] month_and_year.py --- month_and_year.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 month_and_year.py diff --git a/month_and_year.py b/month_and_year.py new file mode 100644 index 00000000..bbed2600 --- /dev/null +++ b/month_and_year.py @@ -0,0 +1,16 @@ +""" +previous issue : prints only month at the moment because you have mentioned only %B to extrac the year we need to use %Y along with %B(i.e month) +""" + +from datetime import datetime + +date = "29-01-2025" + +date_obj= datetime.strptime(date, "%d-%m-%Y") +print(date_obj.strftime("%B %Y")) + + +# mention that if you’re looping through dates from a CSV, then you just need to apply the format like: + +# data_obj = datetime.strptime(date,"%d-%m-%Y") +# print(data_obj.strftime(%B %Y)) %B for month and %Y for year \ No newline at end of file From fb53fe52a500d6415b044ec92617976e8e019c02 Mon Sep 17 00:00:00 2001 From: Abhilash Date: Wed, 23 Apr 2025 19:55:28 +0530 Subject: [PATCH 2/2] billing.py --- billing.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 billing.py diff --git a/billing.py b/billing.py new file mode 100644 index 00000000..c3fff306 --- /dev/null +++ b/billing.py @@ -0,0 +1,3 @@ +prices = [12.99, 5.49, 8.75] +total = sum(prices) +print(total) \ No newline at end of file