Quiz - 2

Develop the function es_triangulo that receives three positive integers a, b, and c. They represent the sides of a triangle. The function should verify that a triangle is formed with the given parameters. If the given parameters form a triangle, the function should return a string indicating its type, i.e., "Equilátero", "Isósceles", or "Escaleno", otherwise, the function should return the string, "No es triángulo".|br| Note: remember that it is not a triangle when the longest side is greater than or equal to the sum of the other two.

es_triangulo(2, 2, 2) -> "Equilátero"
es_triangulo(3, 2, 2) -> "Isósceles"
es_triangulo(4, 2, 6) -> "No es triángulo"
es_triangulo(2, 1, 8) -> "No es triángulo"

Develop the function es_bisiesto that receives the parameter anio which is a positive integer greater than zero and represents a year. The function should verify if the given parameter is a leap year, therefore, it should return True if it is, or False otherwise. A year is a leap year if it is divisible by 400, or also if it is divisible by 4 but not divisible by 100.

es_bisiesto(2014) -> False
es_bisiesto(2016) -> True
es_bisiesto(1900) -> False
es_bisiesto(2000) -> True

Juan Pablo the fisherman, is a good man who works every day of the week. At the end of each work day, Juan must report to the state. Every time he brings a weight of fish greater than established by fishing regulations (50 kilograms) he must pay a fine of 4.00 units per additional kilogram. To keep track, he bought a computer to monitor his work income and asked you to make the function called generate_report that receives a list of positive floats weights, which represent the amount that Juan fished each day of the week. The function should return an array of tuples, where each tuple should be a pair of the form (additional, fine), which represent the amount of additional kilograms that Juan fished during a day and the fine he had to pay respectively. If he did not pay a fine, the result will be 0.0 in both cases.

generate_report([25.5, 50.5, 60.25, 15, 100, 50, 30.50]) -> [(0.0, 0.0), (0.5, 2.0), (10.25, 41.0), (0.0, 0.0), (50.0, 200.0), (0.0, 0.0), (0.0, 0.0)]

Develop the function mayor_tres that receives three integers a, b and c. The function must return the highest of the three numbers, without using the functions max or min.

mayor_tres(5, 2, 3) -> 5
mayor_tres(-5, 0, -2) -> 0

Develop the function mayor_menor_tres that receives three integers a, b and c. The function must return a tuple of the form (mayor, menor) that represent the highest and the lowest of the three numbers, without using the functions max or min.

mayor_menor_tres(5, 2, 3) -> (2, 5)
mayor_menor_tres(-5, 0, -2) -> (-2, 0)

An employee of a company receives a monthly gross salary calculated by the amount of hours worked multiplied by its value. From this salary, the month’s 11% for taxes, 8% for health insurance, and 5% for payment to the union are deducted. Develop the function calcular_salario that receives a float valor_hora and an integer cantidad_horas that represent how much he earns per hour and the amount of hours worked during the month. The function must return a dictionary of the form:

{"salario_bruto": A, "impuestos": B,
"seguro_medico": C, "sindicato": E, "salario_neto": F}.

Where A, B, C, and D represent the amount of money corresponding to each item.

calcular_salario(15.0, 120) -> {"salario_bruto": 1800.00, "impuestos": 198.00,
"seguro_medico": 144.0, "sindicato": 90.0, "salario_neto": 1368.00}.

The paint sold at your trusted hardware store has a coverage of 1 liter per every 3 square meters and the paint is sold only in cans of 18 liters that cost each one 80.00 units. Develop the function puedo_pintar that receives an amount in square meters of an area to be painted as a positive integer area. The function should return a tuple with the amount of cans of paint that need to be bought to cover the entire area, as well as their total price, that is, using the form (amount_cans, total_price).
Note: only an integer number of cans of paint is sold.

puedo_pintar(10) -> (1, 80.00)
puedo_pintar(100) -> (2, 160.00)
puedo_pintar(54) -> (1, 80.00)
puedo_pintar(55) -> (2, 160.00)

You have attempted of activities on this page