Есть ответ 👍

Выделите победителя игры(того кто первый наберёт ) Потом спросите хочет ли игрок начать игру заново. Если ответ будет "да" начните заново
(❗python❗)

253
423
Посмотреть ответы 2

Ответы на вопрос:


from os import system

from random import randint

answ = 'да'

answers = ['камень', 'ножницы', 'бумага']

while answ == 'да':

   system("cls")

   bot_balls = 0

   person_balls = 0

   while bot_balls < 3 and person_balls < 3:

       

       person = str(input("\nВаш вариант: "))

       

       bot = answers[randint(0, 2)]

       print("Я выбрал:", bot)

       if person == bot:

           print("Ничья")

       elif (person == answers[0] and bot == answers[1]) or (person == answers[1] and bot == answers[2]) or (person == answers[2] and bot == answers[1]):

           print("Вы победили!")

           person_balls += 1

       elif (person == answers[0] and bot == answers[2]) or (person == answers[1] and bot == answers[0]) or (person == answers[2] and bot == answers[1]):

           print("Вы проиграли!")

           bot_balls += 1

       print("Счет:", person_balls, ":", bot_balls)

   

   answ = str(input("\nХотите продолжить?: "))

system("cls")

print(" за игру!")

if person_balls > bot_balls:

   print("Вы победили со счетом:", person_balls, ":", bot_balls)

else:

   print("Вы проигради со счетом:", person_balls, ":", bot_balls)

conyp2005
4,6(73 оценок)

bool ok1(int a, int b, int c){

  return (a+b > c && a+c > b && b+c > a) && min(a,min(b,c)) > 0;

}

bool ok2(int a, int b, int c){

  return ok1(a,b,c) && (a == b || a == c || b == c);

}

signed main(){

  const int n = 3, m = 7;

  int arr[n][m];

  for(int i = 0; i < n; i++)

      for(int j = 0; j < m; j++)

          cin >> arr[i][j];

  vector<int> ans;

  for(int j = 0; j < m; j++)

      if(ok2(arr[0][j],arr[1][j],arr[2][j]))

          ans.push_back(j+1);

  cout << ans.size() << "\n";

  for(auto i: ans)

      cout << i << " ";

}

Подробнее - на -

Объяснение:

Популярно: Информатика