Answers for "negative indexing in python example"

3

python negative indexing

list = ["Python", "Java", "C++", "Javascript", "SQL", "PHP"]
print(list[-1]) # "PHP"
print(list[-4]) # "C++"
print(list[:-3]) # ["Python", "Java", "C++"]
print(list[-2:]) # ["Javascript", "SQL", "PHP"]
print(list[-5:-2]) # ["Java", "C++", "Javascript"]
Posted by: Guest on May-27-2020
1

negative indexing in python

thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(thislist[-2:])

# ["melon","mango"]
Posted by: Guest on May-17-2020
0

negative indexing in python example

negative indexing on python example
Posted by: Guest on August-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language