Created
April 9, 2018 10:39
-
-
Save navidanindya/c581cdf4ada8a7bd1ffd025d2cc12bed to your computer and use it in GitHub Desktop.
Prints a list numerically in Python 3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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