added all files reserch

This commit is contained in:
Danamir
2025-12-03 08:59:14 +03:00
parent a592701a3c
commit bdcf20478e
15 changed files with 1051 additions and 0 deletions

27
1.py Normal file
View File

@@ -0,0 +1,27 @@
import matplotlib.pyplot as plt
# Get the input from the user
base = float(input("Enter the length of the base of the trapezoid: "))
height = float(input("Enter the height of the trapezoid: "))
square_side = float(input("Enter the length of the side of the square: "))
# Calculate the area of the trapezoid
area = (base + height) / 2 * square_side
# Calculate the number of squares that can be divided from the trapezoid
num_squares = int(area / square_side**2)
# Create a figure and axes
fig, ax = plt.subplots()
# Draw the trapezoid
ax.fill_betweenx([height / 2, height / 2, height, height], [0, base / 2, base / 2 + base, base], color='blue')
# Draw the squares
for i in range(num_squares):
x = i * square_side
y = height / 2
ax.fill([x, x + square_side, x + square_side, x], [y, y, y + square_side, y + square_side], color='red')
# Show the plot
plt.show()