Предмет: Информатика, автор: loxnikita31

Срочно задание по информатикеЗадание 1. Напишите программу содержащую функции для расчета периметров прямоугольника, квадрата, треугольника, трапеции и ромба.
Задание 2. Напишите программу содержащую функцию для расчета данной формулы: (a+b)/4 + (a-b)/2 - c/a + b/c

Ответы

Автор ответа: bektemissovadilet
0

Ответ:

1) Задание

def perimeter_rectangle(length, width):

"""Calculate the perimeter of a rectangle given its length and width.

Args:

length (float): The length of the rectangle.

width (float): The width of the rectangle.

Returns:

float: The perimeter of the rectangle.

"""

return 2 * (length + width)

def perimeter_square(side):

"""Calculate the perimeter of a square given its side length.

Args:

side (float): The side length of the square.

Returns:

float: The perimeter of the square.

"""

return 4 * side

def perimeter_triangle(side_a, side_b, side_c):

"""Calculate the perimeter of a triangle given the lengths of its sides.

Args:

side_a (float): The length of the first side of the triangle.

side_b (float): The length of the second side of the triangle.

side_c (float): The length of the third side of the triangle.

Returns:

float: The perimeter of the triangle.

"""

return side_a + side_b + side_c

def perimeter_trapezoid(side_a, side_b, height):

"""Calculate the perimeter of a trapezoid given the lengths of its bases and height.

Args:

side_a (float): The length of the first base of the trapezoid.

side_b (float): The length of the second base of the trapezoid.

height (float): The height of the trapezoid.

Returns:

float: The perimeter of the trapezoid.

"""

return side_a + side_b + 2 * height

def perimeter_rhombus(diagonal_a, diagonal_b):

"""Calculate the perimeter of a rhombus given the lengths of its diagonals.

Args:

diagonal_a (float): The length of the first diagonal of the rhombus.

diagonal_b (float): The length of the second diagonal of the rhombus.

Returns:

float: The perimeter of the rhombus.

"""

return 4 * (diagonal_a**2 + diagonal_b**2)**0.5

2)

def calculate_formula(a, b, c):

"""Calculate the result of the formula (a+b)/4 + (a-b)/2 - c/a + b/c.

Args:

a (float): The first parameter of the formula.

b (float): The second parameter of the formula.

c (float): The third parameter of the formula.

Returns:

float: The result of the formula.

"""

return (a + b) / 4 + (a - b) / 2 - c / a + b / c

Похожие вопросы
Предмет: Английский язык, автор: Frotka41
Завдання 1. Обрать правильний варіант. 1. The boy (ening/opened) the window is my brother. 2. They sent all day in the park (playing/played) football. 3. The drank only (boiling/boiled) water. 4. You can find (packing/packed) lunch in the fridge. 5'll come early. (So I will/So will I). 6. I don't come early. (So do I/Neither do I). 7. Spain is situated in Europe. What is (its/it's) capital? (Its/it's) capital is Madrid. 8. Scotland is famous for (its/it's) castles. (Its/It's) beautiful. 9. Have you any (further/ farther) questions? 10. There are (less/fewer) people in the country. Завдання. 2. Доповніть діалог за допомогою зворотів «So is/docs/will/can/has he/»> «. I can't skate. I never skate. I won't skate.. I am dancing. I sometimes ride a bike. I'm not late.. She never goes to the park.. I'll be ready in an hour. I don't wear jeans..... I have got an umbrella. Завдання 3. Побудуйте питальне розподiльне речення. Ben won't go sightseeing with you, There isn't an atlas in the schoolbag, That is a new map, . The sheep sleeps here, The sheep are hungry, There were three boys in the bus, I am grateful for the help... They write a lot of letters, He never wins,. Kate met the actor... Завдання 4. Поставте відповідні петова. Tellin discovery Alexander Fleming. ? .? The Harry Potter books written by J. K. Rowling. The music for this Opera.......composed by Andrew Lloyd Webber. Many films....... produced in Hollywood. Breakfast... served from 7:00 am to 11:00 am daily.

Предмет: Математика, автор: karina15641