Skip to content

Instantly share code, notes, and snippets.

@Robofied
Created February 5, 2019 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robofied/f21de16188e406394453166fc14ddc18 to your computer and use it in GitHub Desktop.
Save Robofied/f21de16188e406394453166fc14ddc18 to your computer and use it in GitHub Desktop.
## Checking the index of '1'
l3.index(1)
#[Output]:
#1
## Here we start searching beyond the index in which '1' lies so it throws ValueError
l3.index(1,2)
#[Output]:
#---------------------------------------------------------------------------
#ValueError Traceback (most recent call last)
# in ()
# 1 ## Here we start searching beyond the index in which '1' lies so it throws ValueError
#----> 2 l3.index(1,2)
#ValueError: 1 is not in list
## count() method.
l4 = [1,2,3,2,3,4,5,6]
l4.count(3)
#[Output]:
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment