Skip to content

Instantly share code, notes, and snippets.

@SushmaBaliza
Last active June 4, 2020 05:50
Show Gist options
  • Save SushmaBaliza/7b4ff1fc66441dd1b9070ff2eed4c213 to your computer and use it in GitHub Desktop.
Save SushmaBaliza/7b4ff1fc66441dd1b9070ff2eed4c213 to your computer and use it in GitHub Desktop.
list_1 = [2, 4, 6, 7, 10, 12, 13, 15, 17]
print(list_1)
# Returns new value for 4th element
list_1[3] = 8
print(list_1)
# Returns new value for 7th, 8th & 9th element
list_1[6:9] = [14, 16, 18]
print(list_1)
# Returns new value as string
list_1[0] = "Code Refer"
print(list_1)
# Provided value for out of range index
list_1[11] = 20
print(list_1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment