Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

English fixes #361

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 53 additions & 53 deletions _sources/quiz/Quiz10_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ Quiz - 10
.. activecode:: q10_1_en
:nocodelens:

Develop the function ``cuantas_donas`` that takes ``n``, a positive integer, as a parameter,
Develop the function ``how_many_donuts`` that takes ``n``, a positive integer, as a parameter,
and returns a string in the form of ``"Number of donuts: n"``, where ``n`` is the value
passed to the function as an argument. However, if ``n`` >= 10, ``cuantas_donas`` will
passed to the function as an argument. However, if ``n`` >= 10, ``how_many_donuts`` will
return ``"many"`` instead of ``n``. |br| |br|
Examples: |br|
``cuantas_donas(5)`` -> ``"Number of donuts: 5"`` |br|
``cuantas_donas(23)`` -> ``"Number of donuts: many"`` |br|
``how_many_donuts(5)`` -> ``"Number of donuts: 5"`` |br|
``how_many_donuts(23)`` -> ``"Number of donuts: many"`` |br|

~~~~
def cuantas_donas(n):
def how_many_donuts(n):


====
Expand All @@ -33,15 +33,15 @@ Quiz - 10
class myTests(TestCaseGui):
def testOne(self):

self.assertEqual(cuantas_donas(4), "Number of donuts: 4", "Expected output: Number of donuts: 4")
self.assertEqual(cuantas_donas(9), "Number of donuts: 9", "Expected output: Number of donuts: 9")
self.assertEqual(how_many_donuts(4), "Number of donuts: 4", "Expected output: Number of donuts: 4")
self.assertEqual(how_many_donuts(9), "Number of donuts: 9", "Expected output: Number of donuts: 9")
self.assertEqual(
cuantas_donas(10),
how_many_donuts(10),
"Number of donuts: many",
"Expected output: Number of donuts: many",
)
self.assertEqual(
cuantas_donas(99),
how_many_donuts(99),
"Number of donuts: many",
"Expected output: Number of donuts: many",
)
Expand All @@ -55,15 +55,15 @@ Quiz - 10
.. activecode:: q10_2_en
:nocodelens:

Develop the function ``cadena_de_extremos`` that, given a string ``s``,
Develop the function ``chain_of_extremes`` that, given a string ``s``,
returns a string with the first two and last two letters of ``s``.
However, if the string has less than 2 letters, it returns an empty string. |br| |br|
Examples: |br|
``cadena_de_extremos("palmeras")`` -> ``"paas"`` |br|
``cadena_de_extremos("a")`` -> ``""`` |br|
``chain_of_extremes("palms")`` -> ``"pams"`` |br|
``chain_of_extremes("a")`` -> ``""`` |br|

~~~~
def cadena_de_extremos(s):
def chain_of_extremes(s):


====
Expand All @@ -73,12 +73,12 @@ Quiz - 10
class myTests(TestCaseGui):
def testOne(self):

self.assertEqual(cadena_de_extremos("palmeras"), "paas", "Expected output: paas")
self.assertEqual(cadena_de_extremos("algoritmos"), "alos", "Expected output: alos")
self.assertEqual(cadena_de_extremos("co"), "coco", "Expected output: coco")
self.assertEqual(cadena_de_extremos("a"), "", "Expected output: ''")
self.assertEqual(cadena_de_extremos("xyz"), "xyyz", "Expected output: xyyz")
self.assertEqual(cadena_de_extremos(""), "", "Expected output: ''")
self.assertEqual(chain_of_extremes("palms"), "pams", "Expected output: pams")
self.assertEqual(chain_of_extremes("algorithms"), "alms", "Expected output: alms")
self.assertEqual(chain_of_extremes("co"), "coco", "Expected output: coco")
self.assertEqual(chain_of_extremes("a"), "", "Expected output: ''")
self.assertEqual(chain_of_extremes("xyz"), "xyyz", "Expected output: xyyz")
self.assertEqual(chain_of_extremes(""), "", "Expected output: ''")


myTests().main()
Expand All @@ -89,17 +89,17 @@ Quiz - 10
.. activecode:: q10_3_en
:nocodelens:

Develop the function ``remplazar_primer_caracter`` that, given a string ``s``,
Develop the function ``replace_first_character`` that, given a string ``s``,
returns a string in which all occurrences of the first character in ``s``
are replaced by "*", except for the first one. **Note:**
use the method ``.replace(value_to_replace, new_value)`` to solve the
exercise. |br| |br|
Examples: |br|
``remplazar_primer_caracter("google")`` -> ``"goo*le"`` |br|
``remplazar_primer_caracter("dona")`` -> ``"dona"`` |br|
``replace_first_character("google")`` -> ``"goo*le"`` |br|
``replace_first_character("donut")`` -> ``"donut"`` |br|

~~~~
def remplazar_primer_caracter(s):
def replace_first_character(s):


====
Expand All @@ -109,10 +109,10 @@ Quiz - 10
class myTests(TestCaseGui):
def testOne(self):

self.assertEqual(remplazar_primer_caracter("babble"), "ba**le", "Expected output: ba**le")
self.assertEqual(remplazar_primer_caracter("aardvark"), "a*rdv*rk", "Expected output: a*rdv*rk")
self.assertEqual(remplazar_primer_caracter("google"), "goo*le", "Expected output: goo*le")
self.assertEqual(remplazar_primer_caracter("dona"), "dona", "Expected output: dona")
self.assertEqual(replace_first_character("babble"), "ba**le", "Expected output: ba**le")
self.assertEqual(replace_first_character("aardvark"), "a*rdv*rk", "Expected output: a*rdv*rk")
self.assertEqual(replace_first_character("google"), "goo*le", "Expected output: goo*le")
self.assertEqual(replace_first_character("donut"), "donut", "Expected output: donut")


myTests().main()
Expand All @@ -123,7 +123,7 @@ Quiz - 10
.. activecode:: q10_4_en
:nocodelens:

Develop the function ``combinar_dos_cadenas`` that takes two strings as
Develop the function ``combine_two_chains`` that takes two strings as
arguments, ``a`` and ``b``, and returns a new string in the following way:

- The new string has to be a combination of ``a`` and ``b``.
Expand All @@ -133,11 +133,11 @@ Quiz - 10
Suppose that ``a`` and ``b`` have more than 2 characters.
For better clarification, see the following examples. |br| |br|
Examples: |br|
``combinar_dos_cadenas("mix", "pod")`` -> ``"pox mid"`` |br|
``combinar_dos_cadenas("pezzy", "firm")`` -> ``"fizzy perm"`` |br|
``combine_two_chains("mix", "pod")`` -> ``"pox mid"`` |br|
``combine_two_chains("pezzy", "firm")`` -> ``"fizzy perm"`` |br|

~~~~
def combinar_dos_cadenas(a, b):
def combine_two_chains(a, b):


====
Expand All @@ -147,14 +147,14 @@ Quiz - 10
class myTests(TestCaseGui):
def testOne(self):

self.assertEqual(combinar_dos_cadenas("mix", "pod"), "pox mid", "Expected output: pox mid")
self.assertEqual(combinar_dos_cadenas("dog", "dinner"), "dig donner", "Expected output: dig donner")
self.assertEqual(combine_two_chains("mix", "pod"), "pox mid", "Expected output: pox mid")
self.assertEqual(combine_two_chains("dog", "dinner"), "dig donner", "Expected output: dig donner")
self.assertEqual(
combinar_dos_cadenas("gnash", "sport"),
combine_two_chains("gnash", "sport"),
"spash gnort",
"Expected output: spash gnort",
)
self.assertEqual(combinar_dos_cadenas("pezzy", "firm"), "fizzy perm", "Expected output: fizzy perm")
self.assertEqual(combine_two_chains("pezzy", "firm"), "fizzy perm", "Expected output: fizzy perm")


myTests().main()
Expand All @@ -166,15 +166,15 @@ Quiz - 10
.. activecode:: q10_5_en
:nocodelens:

Develop the function ``es_palindromo`` that takes a string ``s`` as
Develop the function ``is_palindrome`` that takes a string ``s`` as
parameter and checks if ``s`` is a palindrome or not, returning ``True`` or
``False`` accordingly. |br| |br|
Examples: |br|
``es_palindromo("asa")`` -> ``True`` |br|
``es_palindromo("casa")`` -> ``False`` |br|
``is_palindrome("ivi")`` -> ``True`` |br|
``is_palindrome("civil")`` -> ``False`` |br|

~~~~
def es_palindromo(s):
def is_palindrome(s):


====
Expand All @@ -184,12 +184,12 @@ Quiz - 10
class myTests(TestCaseGui):
def testOne(self):

self.assertEqual(es_palindromo("asa"), True, "Expected output: True")
self.assertEqual(es_palindromo("casa"), False, "Expected output: False")
self.assertEqual(es_palindromo("reconocer"), True, "Expected output: True")
self.assertEqual(es_palindromo("palabra"), False, "Expected output: False")
self.assertEqual(es_palindromo("radar"), True, "Expected output: True")
self.assertEqual(es_palindromo("seres"), True, "Expected output: True")
self.assertEqual(is_palindrome("ivi"), True, "Expected output: True")
self.assertEqual(is_palindrome("civil"), False, "Expected output: False")
self.assertEqual(is_palindrome("level"), True, "Expected output: True")
self.assertEqual(is_palindrome("word"), False, "Expected output: False")
self.assertEqual(is_palindrome("radar"), True, "Expected output: True")
self.assertEqual(is_palindrome("kayak"), True, "Expected output: True")


myTests().main()
Expand All @@ -200,14 +200,14 @@ Quiz - 10
.. activecode:: q10_6_en
:nocodelens:

Develop the function ``contar_ocurrencias`` that takes two parameters:
``frase`` and ``palabra``, both of type string. The function should return
the number of times that ``palabra`` occurs in ``frase``. |br| |br|
Develop the function ``count_occurrences`` that takes two parameters:
``phrase`` and ``word``, both of type string. The function should return
the number of times that ``word`` occurs in ``phrase``. |br| |br|
Examples: |br|
``contar_ocurrencias("a ana y a mariana les gustan las manzanas", "ana")`` -> ``3`` |br|
``count_occurrences("ana and mariana like amanatsu", "ana")`` -> ``3`` |br|

~~~~
def contar_ocurrencias(frase, palabra):
def count_occurrences(frase, palabra):


====
Expand All @@ -218,11 +218,11 @@ Quiz - 10
def testOne(self):

self.assertEqual(
contar_ocurrencias("a ana y a mariana les gustan las manzanas", "ana"),
count_occurrences("ana and Mariana like amanatsu", "ana"),
3,
"Expected output: 3",
)
self.assertEqual(contar_ocurrencias("Cats, rats, bats, and hats.", "ats"), 4, "Expected output: 4")
self.assertEqual(count_occurrences("Cats, rats, bats, and hats.", "ats"), 4, "Expected output: 4")


myTests().main()
myTests().main()
Loading
Loading