6466743532
09.02.2022 12:24

Ошибка в программе (Python, PyQt5) From PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QPushButton
from random import randint
Bal = 1000
app = QApplication([])
win = QWidget()
batter = QPushButton("Крутить")
text = QLabel("?")
text2 = QLabel("?")
win.setWindowTitle("Казино Вулкан")
text3 = QLabel("Нажмите, чтобы крутить колесо")
text4 = QLabel("Ваш баланс:" +str(Bal))
bal2 = QPushButton()
bal2.hide()

line = QVBoxLayout()
line.addWidget(text3, alignment = Qt.AlignCenter)
line.addWidget(text2, alignment = Qt.AlignCenter)
line.addWidget(text, alignment = Qt.AlignCenter)
line.addWidget(batter, alignment = Qt.AlignCenter)
line.addWidget(text4, alignment = Qt.AlignCenter)
line.addWidget(bal2, alignment = Qt.AlignCenter)

win.setLayout(line)
def show_text():
global Bal
namber = randint(0,9)
text.setText(str(namber))
namber2 = randint(0,9)
text2.setText(str(namber2))
if namber == namber2:
text3.setText('Вы выиграли! Сыграйте снова')
Bal = Bal +100
text4.setText("Ваш баланс:" +str(Bal))
elif namber != namber2:
Bal = Bal -100
text4.setText("Ваш баланс:" +str(Bal))
text3.setText('Вы проиграли! Сыграйте снова')
def show_bal():
if Bal == 0:
text4.show()
bal2.show()
text3.setText("Пополните баланс.")
batter.hide()
text.hide()
text2.hide()
bal2.setText("Пополнить баланс")
batter.clicked.connect(show_text)

win.show()
app.exec_()

Программа на видит:
if Bal == 0:
text4.show()
bal2.show()
text3.setText("Пополните баланс.")
batter.hide()
text.hide()
text2.hide()
bal2.setText("Пополнить баланс")

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
angelok8408
07.07.2022 01:25
Var a:array[1..100,1..100] of integer; i,j,n,m,max,min:integer; begin write ('Введите количество строк: '); read(n); writeln; write ('Введите количество элементов в строке: '); read(m); writeln; writeln('Введите массив: '); for i:=1 to n do begin for j:=1 to m do begin write(' a[',i,',',j,']='); read(a[i,j]); end; writeln; end; writeln; writeln('Исходный массив: '); for i:=1 to n do begin for j:=1 to m do write(a[i,j],' '); writeln; end; writeln; writeln('Конечный массив: '); for i:=1 to n do begin min:=a[i,1]; max:=a[i,1]; for j:=2 to m do begin if (min>a[i,j]) then min:=a[i,j]; if (max
0,0(0 оценок)
Ответ:
usan2005
13.09.2021 21:35
// PascalABC.Net 3.0, сборка 1066
var
  s, wd: string;
  n, pt: integer;

begin
  Write('Введите строку: ');Readln(s);
  n := Length(s); pt := 1;
  repeat
    // Пропускаем все символы до первого непробельного
    while pt <= n do
      if s[pt] = ' ' then Inc(pt) else break;
    if pt <= n then begin
      // Выделяем очередное слово
      wd := '';
      while pt <= n do
        if s[pt] <> ' ' then begin wd := wd + s[pt]; Inc(pt) end
        else break;
      if (wd <> '') and (LowCase(wd[1]) in ['м'..'я']) then Writeln(wd)
    end
  until pt > n;
end.

Тестовое решение:
Введите строку: **А роза    упала   на    лапу Азора    **
роза
упала
на

А вот так версия 3.0 позволяет решить задачу "по-современному":

// PascalABC.Net 3.0, сборка 1066
begin
  var s:=ReadString('Введите строку: ');
  Writeln('Результат: ',s.ToWords(' ').Where(x->x[1] in ['м'..'я']))
end.

Тестовое решение:
Введите строку:  **А роза    упала   на    лапу Азора    **
Результат: [роза,упала,на]
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота