-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17_crud.py
More file actions
46 lines (33 loc) · 756 Bytes
/
17_crud.py
File metadata and controls
46 lines (33 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#CRUD Create, REad, Update & Delete
numbers = [1, 2, 3, 4, 5]
print(numbers[1])
numbers[-1] = 10
print(numbers)
numbers.append(700)
print(numbers)
numbers.insert(0, 'hola')
print(numbers)
numbers.insert(3, 'change')
print(numbers)
tasks = ['todo 1', 'todo 2', 'todo 3']
new_list = numbers + tasks
print(new_list)
index = new_list.index('todo 2')
new_list[index] = 'todo changed'
print(new_list)
new_list.remove('todo 1')
print(new_list)
new_list.pop()
print(new_list)
new_list.pop(0)
print(new_list)
new_list.reverse()
print(new_list)
numbers_a = [1, 4, 6, 3]
numbers_a.sort()
print(numbers_a)
strings = ['re', 'ab', 'ed']
strings.sort()
print(strings)
#new_list.sort()error no se pueden ordenar cuando hay elementos mezclados
#print(new_list)