Skip to content

Instantly share code, notes, and snippets.

@navidanindya
Created April 9, 2018 10:39
Show Gist options
  • Save navidanindya/c581cdf4ada8a7bd1ffd025d2cc12bed to your computer and use it in GitHub Desktop.
Save navidanindya/c581cdf4ada8a7bd1ffd025d2cc12bed to your computer and use it in GitHub Desktop.
Prints a list numerically in Python 3.
hobbits = ['Frodo', 'Samwise', 'Merry', 'Pippin']
wizards = ['Gandalf', 'Saruman', 'Radagast']
# Function starts
def printList(lists):
for number, item in enumerate(lists, 1):
print(str(number) + " " + item)
print("\n")
# Function ends
printList(hobbits)
printList(wizards)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment