Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help
#2
Hi, First of all let's look at GetMonths function. You don't need to supply Months as argument. You just need Years and then return calculated Months.
Now the error - the error comes because at the time of the function call name Months does not exists.

def get_months(years):
    months = years * 12 
    return months
most people would simply:
def get_months(years):
    return years * 12
and call it (e.g. print the result) like this:

print(get_months(25))
as a general note - take a look at PEP-8 - the styling guide, naming conventions, etc.
Reply


Messages In This Thread
Help - by MartinEvtimov - Feb-24-2017, 07:50 AM
RE: Help - by buran - Feb-24-2017, 09:51 AM

Forum Jump:

User Panel Messages

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