Header Ads

Responsive Ads Here

Basics of Lists

 Basics of  Lists



mixed = ["Xtra", "Coding", 14, 1.6, True, False]
print(mixed)
print(mixed[::2])

numbers = [1,2,3,4,5]
print(numbers)
print(numbers[2:]) # Slice a part of the list

strings = ["string1", "Xtra", "Coding"]
print(strings)

print(strings[1]) # Access any value out of the list

strings[1] = "Adrika"  # Change any value of list
print(strings)

strings[1:] = "abc"
print(strings)

strings[1:] = ["Adrika", 14]
print(strings)

Powered by Blogger.