Print the values of list by using list range index position in python

Source Code

strt=int(input(“Enter the starting range : “))

end=int(input(“Enter the end range : “))

end=5

thislist = [“apple”, “banana”, “cherry”, “orange”, “kiwi”, “melon”, “mango”]

print(thislist[strt:end])

Output

Enter the starting range : 1

Enter the end range : 4

[‘banana’, ‘cherry’, ‘orange’, ‘kiwi’]

Leave a Comment

Your email address will not be published. Required fields are marked *