Liste en Python
list = ["string", 69, 6.9, True]
cool dude
list = ["string", 69, 6.9, True]
a1 = [1, 'x', 'y']
a2 = [1, 'x', 'y']
a3 = [1, 'x', 'y']
b = [2, 3]
a1.append(b)
a2.insert(3, b)
a3.extend(b)
print(a1)
print(a2)
print(a3
# A list is a collection of items.
# Lists are mutable: you can change their elements and their size.
# Similar to List<T> in C#, ArrayList<T> in Java, and array in JavaScript.
foo = [1, 2, True, "mixing types is fine"]
print(foo[0])
# Output - 1
foo[0] = 3
print(foo[0])
# Output - 3
thislist = ["1.apple", "2.banana", "3.cherry", "4.orange", "5.kiwi", "6.melon", "7.mango"]
# thislist[starting index(including) : end index(not including)]
print(thislist[:]) #Output: ['1.apple', '2.banana', '3.cherry', '4.orange', '5.kiwi', '6.melon', '7.mango']
print(thislist[1:]) #Output: ['2.banana', '3.cherry', '4.orange', '5.kiwi', '6.melon', '7.mango']
print(thislist[:5]) #Output: ['1.apple', '2.banana', '3.cherry', '4.orange', '5.kiwi']
print(thislist[2:5]) #Output: ['3.cherry', '4.orange', '5.kiwi']
print(thislist[::3]) #Output: ['1.apple', '4.orange', '7.mango']
print(thislist[1::2]) #Output: ['2.banana', '4.orange', '6.melon']
print(thislist[1:6:3]) #Output: ['2.banana', '5.kiwi']
>> variable = "PYTHON"
>> variable[2]
"T"
>> variable[-4]
"T"
hello kcndkcd