I have some practice homework with creating a function in python. One of them outputs a list of months. This is my code:
def outputlist(list):
for list_output in list:
print(list_output,end=" ")
return list_output
def main():
month = ["January", "February", "March", "April", "May", "June", "July", "August", "Setemper", "October", "November", "December"]
print("The list of the months of the year are:", outputlist(month))
main()
I don't know why the output sentence does not follow in order, It should be:
"The list of the months of the year are: January February March April May June July August September October November December"
However, the output that I get is:
January February March April May June July August September October November December 1. The list of the months of the year are: December
print()andreturn?print("The list of the months of the year are:", *month)*