Miguel Hernandez
asked on
Printing the result of a function in Python 3.6
Hi, this is my code:
def how_many_days(month_number ):
days_in_month = [31,28,31,30,31,30,31,31,3 0,31,30,31 ]
print(how_many_days[8])
When I try to run it, I get an error message: "function object is not subscriptable".
Thanks for your help!
def how_many_days(month_number
days_in_month = [31,28,31,30,31,30,31,31,3
print(how_many_days[8])
When I try to run it, I get an error message: "function object is not subscriptable".
Thanks for your help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Flabio:
Thank you for your help. I am trying to learn Python via Udacity and sometimes get confused!. For example, I believed that I need to use [] in ther [] in "returning" to specify that the element is from a list.
Thank you for your help. I am trying to learn Python via Udacity and sometimes get confused!. For example, I believed that I need to use [] in ther [] in "returning" to specify that the element is from a list.
Leaving it within your function will result in recursion which is NOT what you want in this case.