Python Forum
How to calculate the year by adding n months?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to calculate the year by adding n months?
#1
Hi Everyone,

I've successfully solved many problems. I'm even starting to solve some in the 'easy' category on Edabit. However, this 'very easy' problem seems harder than the category says. I'm really lost and don't know where to begin. Here is the problem:

Create a function that takes in year and month as input, then return what year it would be after n-months has elapsed.

Examples
after_n_months(2020, 24) ➞ 2022

after_n_months(1832, 2) ➞ 1832

after_n_months(1444, 60) ➞ 1449
Notes
Assume that adding 12 months will always increment the year by 1.
If no value is given for year or months, return "year missing" or "month missing".
At least one value will be present.
Reply


Messages In This Thread
How to calculate the year by adding n months? - by pav1983 - Jun-27-2020, 06:11 PM
RE: After N Months - by ndc85430 - Jun-27-2020, 06:13 PM
RE: After N Months - by pav1983 - Jun-27-2020, 06:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to calculate a months' 1st, 4th, 7th day and also 1st again? cananb 1 1,563 Nov-11-2020, 09:17 PM
Last Post: deanhystad
  how to tell python to do something every 6 months Jezani_VIII 1 1,982 Aug-18-2019, 02:30 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020