You are on page 1of 1

##Part 1

#Variable

a_variable = 9
some_other_variable = a_variable + 4
another_variable = "Hello"
some_other_variable = a_variable * 3
print(a_variable)

#Tableau

a_list = [2, 3.0, "Hello"]


print(a_list[0])
a_list[1] = 4
print(my_list)
# Retrieve the FIRST 4 elements of my_list
first_elements = my_list[:4]
# Retrieve the LAST 3 elements of my_list
last_elements = my_list[-3:]

#file/list

# Delete and return the element located at index 4


my_list.pop(4)

l=[0,6,4,6]
# Deletion of value 6
l.remove(6)
# List l after deleting value 6
print(l)
>>> [0,4,6]

print("List after deleting all values equal to 2 :",l)

# Insertion of the value "Hello" at index 2


my_list.insert(2, "Hello")

# Addition of the element "Goodbye" at the end of the list


my_list.append("Goodbye")

list_1 = list_1 + list_2

l.sort()
l.sort(reverse=True)

You might also like