промежутое

This commit is contained in:
2025-12-05 11:48:13 +05:00
parent 30647281a5
commit dcb80ef973
48 changed files with 1190 additions and 0 deletions

58
programm/bubble.py Normal file
View File

@@ -0,0 +1,58 @@
import random
def create():
l = []
for i in range(10):
a = random.randint(0,100)
l.append(a)
debug(l)
return l
def len(mass):
temp=0
for i,j in enumerate(mass):
temp+=1
return temp
def max(mass):
temp=0
for i,j in enumerate(mass):
if temp<j:
temp=j
return temp
def sort(mass):
temp_mass = mass
len_mass = len(mass=temp_mass)
max_int=max(temp_mass)
while True:
temp=0
for i,j in enumerate(temp_mass):
if i+1<len_mass:
if temp_mass[i] < temp_mass[i+1]:
temp+=1
if temp == len_mass-1:
return temp_mass
for i in range(len_mass):
if i+1<len_mass:
if temp_mass[i] < temp_mass[i+1]:
pass
else:
temp = temp_mass[i]
temp_mass[i] = temp_mass[i+1]
temp_mass[i+1]= temp
def debug(mass):
print(f"{mass=}")
def programm():
mass=create()
sort(mass=mass)
debug(mass=mass)
programm()