You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _sources/quiz/Quiz11_en.rst
+6-6
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Quiz - 11
10
10
11
11
.. tab:: Exercise 1
12
12
13
-
.. activecode:: q11_1
13
+
.. activecode:: q11_1_en
14
14
:nocodelens:
15
15
16
16
Develop the function ``verbo`` that receives a string ``s`` as a parameter. If the length of the string is at least 3, it should return the original string concatenated with ``"ing"`` at the end. If the string ``s`` already ends with ``"ing"``, concatenate the string ``"ly"``. If the length of the string is less than 3, it returns the original string. |br| |br|
@@ -45,7 +45,7 @@ Quiz - 11
45
45
46
46
.. tab:: Exercise 2
47
47
48
-
.. activecode:: q11_2
48
+
.. activecode:: q11_2_en
49
49
:nocodelens:
50
50
51
51
Develop the function ``no_es_malo`` that receives a string ``s`` as a parameter. The function must search for the first occurrence of the string ``"no es"`` and the last occurrence of the string ``"malo"`` or the string ``"mala"``, if either appears after the first one, replace ``"no es" ... "malo"`` or ``"no es" ... "mala"`` with the strings ``"es bueno"`` or ``"es buena"`` respectively, then return the result. |br| |br|
@@ -105,7 +105,7 @@ Quiz - 11
105
105
106
106
.. tab:: Exercise 3
107
107
108
-
.. activecode:: q11_3
108
+
.. activecode:: q11_3_en
109
109
:nocodelens:
110
110
111
111
Develop the function ``inicio_final`` that receives two strings ``a`` and ``b``. The strings have to be divided into two, if either of the strings has an odd number of characters, the first half will be the longest substring (for example ``dog`` will be divided into: ``do`` and ``g``). Given the two strings, return a new string formed as follows ``a_start + b_start + a_end + b_end``. |br| |br|
@@ -146,7 +146,7 @@ Quiz - 11
146
146
147
147
.. tab:: Exercise 4
148
148
149
-
.. activecode:: q11_4
149
+
.. activecode:: q11_4_en
150
150
:nocodelens:
151
151
152
152
Develop the function ``cuantos_ceros`` that given a positive integer ``n``, returns the number of zeros at the end of the integer. |br| |br|
@@ -183,7 +183,7 @@ Quiz - 11
183
183
184
184
.. tab:: Exercise 5
185
185
186
-
.. activecode:: q11_5
186
+
.. activecode:: q11_5_en
187
187
:nocodelens:
188
188
189
189
Develop the function ``contar_2`` that receives a positive integer ``n`` greater than 0. The function must return the number of times the digit 2 appears in the interval``[0, n-1]``. |br| |br|
@@ -216,7 +216,7 @@ Quiz - 11
216
216
217
217
.. tab:: Exercise 6
218
218
219
-
.. activecode:: q11_6
219
+
.. activecode:: q11_6_en
220
220
:nocodelens:
221
221
222
222
Develop the function ``inicio_potencia`` that receives a positive integer ``n`` greater than 0. The function must return the first power of 2 that starts with ``n``. |br| |br|
Copy file name to clipboardExpand all lines: _sources/quiz/Quiz13_en.rst
+2-2
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Quiz - 13
11
11
12
12
.. tab:: Exercise 1
13
13
14
-
.. activecode:: q13_1
14
+
.. activecode:: q13_1_en
15
15
:nocodelens:
16
16
17
17
Develop the function ``remove_duplicates`` that receives a list ``numbers`` of integers. The function should return a list without repeated elements and sorted in ascending order. |br| |br|
@@ -46,7 +46,7 @@ Quiz - 13
46
46
47
47
.. tab:: Exercise 2
48
48
49
-
.. activecode:: q13_2
49
+
.. activecode:: q13_2_en
50
50
:nocodelens:
51
51
52
52
Develop the function ``encrypt`` that receives a string ``phrase``. The function should return a new encrypted string, following these rules: |br|
Copy file name to clipboardExpand all lines: _sources/quiz/Quiz8_en.rst
+13-12
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Quiz - 8
11
11
12
12
.. tab:: Exercise 1
13
13
14
-
.. activecode:: q8_1
14
+
.. activecode:: q8_1_en
15
15
:nocodelens:
16
16
17
17
Define a function ``first_or_last_6`` that checks whether 6 is the first
@@ -46,7 +46,7 @@ Quiz - 8
46
46
47
47
.. tab:: Exercise 2
48
48
49
-
.. activecode:: q8_2
49
+
.. activecode:: q8_2_en
50
50
:nocodelens:
51
51
52
52
Define a function ``same_ends`` that takes a list ``numbers`` as a parameter,
@@ -84,7 +84,7 @@ Quiz - 8
84
84
85
85
.. tab:: Exercise 3
86
86
87
-
.. activecode:: q8_3
87
+
.. activecode:: q8_3_en
88
88
:nocodelens:
89
89
90
90
Define a function ``common_ends`` that takes two lists ``a`` and ``b``
@@ -135,7 +135,7 @@ Quiz - 8
135
135
136
136
.. tab:: Exercise 4
137
137
138
-
.. activecode:: q8_4
138
+
.. activecode:: q8_4_en
139
139
:nocodelens:
140
140
141
141
Define a function called ``mayor_extremo`` that takes the list "numeros" as parameter, compares the ends of the list and returns a new list of the same size where all elements are the greatest magnitude extreme. |br| |br|
@@ -201,7 +201,7 @@ Quiz - 8
201
201
202
202
.. tab:: Exercise 5
203
203
204
-
.. activecode:: q8_5
204
+
.. activecode:: q8_5_en
205
205
:nocodelens:
206
206
207
207
Define a function called ``sumar_primeros_dos`` that takes the integer list ``numeros`` of any length as parameter and returns the sum of the first two elements. If the list has less than two elements, add 0s. |br| |br|
@@ -241,7 +241,7 @@ Quiz - 8
241
241
242
242
.. tab:: Exercise 6
243
243
244
-
.. activecode:: q8_6
244
+
.. activecode:: q8_6_en
245
245
:nocodelens:
246
246
247
247
Define a function called ``al_medio`` that takes two integer lists ``a`` and ``b`` as parameters, and returns a list of size 2 that contains the middle elements of ``a`` and ``b``. Assume that the lists have an odd length. |br| |br|
@@ -297,7 +297,7 @@ Quiz - 8
297
297
298
298
.. tab:: Exercise 7
299
299
300
-
.. activecode:: q8_7
300
+
.. activecode:: q8_7_en
301
301
:nocodelens:
302
302
303
303
Define a function ``fancy_date``. The function will take two parameters,
@@ -307,11 +307,12 @@ Quiz - 8
307
307
Your clothes score will determine if you get a table at the restaurant or not, according to the following rules: |br|
308
308
309
309
- If the score of one of the two clothing is less than or equal to 2,
310
-
they will not be entitled to a table (``0``). |br|
310
+
they will not be entitled to a table (``0``). |br|
311
311
- If the scores are higher, then if one of them is very
312
-
elegant (score >= 8) they will be entitled to a table (``2``). |br|
312
+
elegant (score >= 8) they will be entitled to a table (``2``). |br|
313
313
- Otherwise, the answer is maybe (``1``). |br|
314
314
315
+
315
316
So ``fancy_date`` returns a number between 0, 1, and 2, which mean No, Maybe, and Yes, respectively. |br| |br|
316
317
Examples: |br|
317
318
``fancy_date(5, 10)`` -> ``2`` |br|
@@ -347,7 +348,7 @@ Quiz - 8
347
348
348
349
.. tab:: Exercise 8
349
350
350
-
.. activecode:: q8_8
351
+
.. activecode:: q8_8_en
351
352
:nocodelens:
352
353
353
354
The *squirrels* soccer team normally plays when the temperature is
@@ -392,7 +393,7 @@ Quiz - 8
392
393
393
394
.. tab:: Exercise 9
394
395
395
-
.. activecode:: q8_9
396
+
.. activecode:: q8_9_en
396
397
:nocodelens:
397
398
398
399
Let's simulate a speedometer that applies a fine if the maximum speed is exceeded:
@@ -450,7 +451,7 @@ Quiz - 8
450
451
451
452
.. tab:: Exercise 10
452
453
453
-
.. activecode:: q8_10
454
+
.. activecode:: q8_10_en
454
455
:nocodelens:
455
456
456
457
Define a function ``set_alarm`` that takes two parameters: The first parameter
Copy file name to clipboardExpand all lines: _sources/quiz/QuizExtras2_en.rst
+3-3
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Quiz - Extras 2
11
11
12
12
.. tab:: Exercise 1
13
13
14
-
.. activecode:: qExtra2_1
14
+
.. activecode:: qExtra2_1_en
15
15
:nocodelens:
16
16
17
17
A primary school is planning a field trip to the zoo for some of its students. For this, the school can only spend exactly ``budget`` units. It is known that the entry to the zoo costs 5 units for children under 12 years old and 7 units for those who are 12 years old or older. Develop the function ``maximo_estudiantes`` that receives ``budget``, a positive integer that indicates the budget that the school intends to spend. The function should return a tuple ``(p, g)`` with the maximum number of small and large students that the school can take to the zoo considering all values as integers. |br| |br|
@@ -42,7 +42,7 @@ Quiz - Extras 2
42
42
43
43
.. tab:: Exercise 2
44
44
45
-
.. activecode:: qExtra2_2
45
+
.. activecode:: qExtra2_2_en
46
46
:nocodelens:
47
47
48
48
Develop the function ``a_romano``, which receives a positive integer ``n`` greater than zero. The function should return the conversion of the number from Arabic to Roman numerals. The function should return a string that represents the number in Roman numerals. |br| |br|
@@ -82,7 +82,7 @@ Quiz - Extras 2
82
82
83
83
.. tab:: Exercise 3
84
84
85
-
.. activecode:: qExtra2_3
85
+
.. activecode:: qExtra2_3_en
86
86
:nocodelens:
87
87
88
88
Develop the function ``calcular_pi``, which receives a positive parameter ``n`` greater than 0. The function should calculate the approximate value of ``pi`` with ``n`` terms, according to the following formula. |br|
Copy file name to clipboardExpand all lines: _sources/quiz/QuizExtras_en.rst
+5-5
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Quiz - Extras
10
10
11
11
.. tab:: Exercise 1
12
12
13
-
.. activecode:: qExtra_1
13
+
.. activecode:: qExtra_1_en
14
14
:nocodelens:
15
15
16
16
**Josephus problem**. Imagine you have ``n`` people arranged in a circle. Suppose these people are numbered from 1 to ``n`` clockwise. Starting with person number **1**,
@@ -36,7 +36,7 @@ Quiz - Extras
36
36
37
37
.. tab:: Exercise 2
38
38
39
-
.. activecode:: qExtra_2
39
+
.. activecode:: qExtra_2_en
40
40
:nocodelens:
41
41
42
42
Implement the **Sieve of Eratosthenes** algorithm. |br|
@@ -69,7 +69,7 @@ Quiz - Extras
69
69
70
70
.. tab:: Exercise 3
71
71
72
-
.. activecode:: qExtra_3
72
+
.. activecode:: qExtra_3_en
73
73
:nocodelens:
74
74
75
75
**Project Euler Problem 2**. `Problem <https://projecteuler.net/problem=2>`_ |br|
@@ -109,7 +109,7 @@ Quiz - Extras
109
109
110
110
.. tab:: Exercise 4
111
111
112
-
.. activecode:: qExtra_4
112
+
.. activecode:: qExtra_4_en
113
113
:nocodelens:
114
114
115
115
In the book "The Man Who Counted," by *Malba Tahan*, a character wanted to win the grains of wheat that were distributed on a chessboard as follows:
@@ -136,7 +136,7 @@ Quiz - Extras
136
136
137
137
.. tab:: Exercise 5
138
138
139
-
.. activecode:: qExtra_5
139
+
.. activecode:: qExtra_5_en
140
140
:nocodelens:
141
141
142
142
You are given ``n`` tiles with dimensions of 10cm x 10cm. With them, you must assemble a set of squares using all the given tiles. To do this, you must follow the following rules:
0 commit comments