Skip to content

Instantly share code, notes, and snippets.

@Jayasagar
Created December 18, 2017 12:46
Show Gist options
  • Save Jayasagar/08494abaae73d42b3f75d2531697cfae to your computer and use it in GitHub Desktop.
Save Jayasagar/08494abaae73d42b3f75d2531697cfae to your computer and use it in GitHub Desktop.
# List of users
list = ['Deli','Corn', 'Alice', 'Bob']
# Length of the user list
print('List Length', len(list))
# List slice
print(list[1:3]) ## ['Corn', 'Alice'] -> include element at index 1 and exclude elememnt at index 3
# Sorting:: sort function doesn't return a value! But 'list' should have sorted.
list.sort()
print(list)
# Reverse
list.reverse()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment