-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExercise3.py
More file actions
127 lines (107 loc) · 3.31 KB
/
Exercise3.py
File metadata and controls
127 lines (107 loc) · 3.31 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#3.1 litas
"""
name = ["daniel", "sergio", "jeison"]
print(name[0].title())
print(name[1])
print(name[2])
#3.2 greeting printing each person's name one at a time
greeting = "Hi " + name[0].upper() + " pinche putito!"
print(greeting)
print("Hi " + name[1].upper() + " pinche putito!")
greeting = "Hi " + name[2].upper() + " pinche putito!"
print(greeting)
"""
#3.3 my own list ( mode of trasportation)
"""
champs_lol = ["rengar" , "leblanc" , "fizz" , "kaisa" , " lucian" ]
oscar = "Kabroun es un puto manco con" + champs_lol[4]
print(oscar)"""
#3.4 lists for dinner
"""
dinner = ["Fredy Mercury" , "Reina Isabel" , "Bender"]
invitation = "Hi " + dinner[0] + " Do you wanna go to dinner tonight ?"
print(invitation)
invitation = "Hi " + dinner[1] + " Do you wanna go to dinner tonight ?"
print(invitation)
invitation = "Hi " + dinner[2] + " Do you wanna go to dinner tonight ?"
print(invitation)
guest = dinner[0].title()
print("Hi " + guest+ " Do you wanna go to dinner tonight?")
"""
#3.5 list change guest
"""
dinner = ["Fredy Mercury" , "Reina Isabel" , "Bender"]
guest = dinner[1]
print(guest + " no puede asistir a cenar esta noche.")
dinner[1] = "El papa"
print(dinner)
guest = dinner[0]
print("Hi " + guest + "\nDo you wanna go to dinner tonight?")
guest = dinner[1]
print("Hi " + guest + "\nDo you wanna go to dinner tonight?")
guest = dinner[2]
print("Hi " + guest + "\nDo you wanna go to dinner tonight?")
#3.6 more guests
print("I got a bigger table")
dinner.insert(0, "Rafa nadal")
dinner.insert(3, "Elon musk")
dinner.append("Willie wonka")
guest = dinner[0].title()
print("Hi " + guest + " Do you wanna go to dinner tonight?")
guest = dinner[1].title()
print("Hi " + guest + " Do you wanna go to dinner tonight?")
guest = dinner[2].title()
print("Hi " + guest + " Do you wanna go to dinner tonight?")
guest = dinner[3].title()
print("Hi " + guest + " Do you wanna go to dinner tonight?")
guest = dinner[4].title()
print("Hi " + guest + " Do you wanna go to dinner tonight?")
guest = dinner[5].title()
print("Hi " + guest + " Do you wanna go to dinner tonight?")
#3.7
print(dinner)
print("excuse me , just i can invite to two guest for dinner")
guest = dinner.pop()
print("sorry," + guest + " table is full")
guest = dinner.pop(0)
print("sorry," + guest + " table is full")
guest = dinner.pop(1)
print("sorry," + guest + " table is full")
guest = dinner.pop(1)
print("sorry," + guest + " table is full")
#invitar a cenar a los restantes de la lista
guest = dinner[0]
print("Hi " + guest.title() +" Do you can still go to dinner tonight ?")
guest = dinner[1]
print("Hi " + guest.title() +" Do you can still go to dinner tonight ?")
del dinner[0]
del dinner[0]
print(dinner)
"""
#3.8 Organizing a List
cities = ['CDMX', 'Santa Marta', 'Madrid', 'Ontario', 'Soacha']
print("original")
print(cities)
print("\nordenada alfabeticamente")
print(sorted(cities))
print("original")
print(cities)
print("\nordenada alfabetico inverso")
print(sorted(cities, reverse=True))#alfabeticamente reversa
print("original")
print(cities)
print("\nreverse")
cities.reverse()
print(cities)
print("\n reverse al reverse")
cities.reverse()
print(cities)
print("\nalfabetica permanente")
cities.sort()
print(cities)
print("\nreverse alfhabetical permanently")
cities.sort(reverse=True)
print(cities)
#3.9
dinner = ["Fredy Mercury" , "Reina Isabel" , "Bender"]
print((len(dinner)))