Quiz - Extras 2ΒΆ

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.

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.

Examples:
a_romano(5) -> "V"
a_romano(10) -> "X"
a_romano(25) -> "XXV"
a_romano(2011) -> "MMXI"

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.

pi = (4/1) - (4/3) + (4/5) - (4/7) ...

The result should be rounded to 2 decimals and returned as a string.

Examples:
calcular_pi(4) -> "2.90"
Explanation: The first 4 terms following the formula are: (4/1) - (4/3) + (4/5) - (4/7) which result in 2.895238095, rounding to two decimal places the final result would be 2.90
calcular_pi(24) -> "3.10"
calcular_pi(61) -> "3.16"
calcular_pi(100) -> "3.13"

You have attempted of activities on this page