class Finder:
def __init__(self):
self.current_range = range(1, 101)
def condition(self, user_select):
if user_select == '1':
return True
elif user_select == '2':
self.current_range = range(int(self.current_half + self.current_range.start), self.current_range.stop)
return False
elif user_select == '3':
self.current_range = range(self.current_range.start, int(self.current_half + self.current_range.start))
return False
@property
def current_half(self) -> int:
return int((self.current_range.stop - self.current_range.start) / 2)
finder = Finder()
while True:
user_select = input(f'Это {finder.current_half + finder.current_range.start}?\n')
result = finder.condition(user_select)
if result:
break
Поделитесь своими знаниями, ответьте на вопрос:
1 v=128000бит/с i=625кбайт t=? сек 2 v=128000бит/с i=625кбайт t=? сек
Pascall
uses crt,graphABC;
var w:char;
xc,yc,c,x,y,i:integer;
begin
hidecursor;
repeat
clrscr;
writeln('Выберите фигуру');
writeln('1-треугольник');
writeln('2-квадрат');
writeln('3-круг');
writeln('4-ромб');
writeln('5-эллипс');
writeln('другое - выход');
read(w);
xc:=windowwidth div 2;
yc:=windowheight div 2;
setpencolor(clRed);
case w of
'1':begin
clrscr;
textout(xc-50,10,'Нажмите Enter');
moveto(xc+round(150*cos(pi/2)),yc-round(150*sin(pi/2)));
for i:=1 to 4 do
begin
x:=xc+round(150*cos((i-1)*(2*pi/3)+pi/2));
y:=yc-round(150*sin((i-1)*(2*pi/3)+pi/2));
lineto(x,y);
end;
readln
end;
'2':begin
clrscr;
textout(xc-50,10,'Нажмите Enter');
rectangle(xc-150,yc-150,xc+150,yc+150);
readln
end;
'3':begin
clrscr;
textout(xc-50,10,'Нажмите Enter');
circle(xc,yc,150);
readln
end;
'4':begin
clrscr;
textout(xc-50,10,'Нажмите Enter');
moveto(xc-100,yc);
lineto(xc,yc-150);
lineto(xc+100,yc);
lineto(xc,yc+150);
lineto(xc-100,yc);
readln
end;
'5':begin
clrscr;
textout(xc-50,10,'Нажмите Enter');
ellipse(xc-150,yc-100,xc+150,yc+100);
readln
end;
end;
until not(w in ['1'..'5'])
end.