Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Zapryan avatar Zapryan 5 Точки

Задача 03. Memory game

Здравейте, колеги! Искам да ви помоля за малко помощ, че не мога да си открия грешката в следната задача:

03. Memory game
Write a program, which receives a sequence of elements. Each element in the sequence will have a twin. Until the player receives "end" from the console, he will receive strings with two integers separated by space, which represent the indexes of elements in the sequence.  
If the player tries to cheat and enters two equal indexes or indexes which are out of bounds of the sequence you should add two matching elements in the following format "-{number of moves until now}a" at the middle of the sequence and print this message on the console:
"Invalid input! Adding additional elements to the board"
Input
On the first line you will receive sequence of elements.
Output
Every time the player hit two matching elements you should remove them from the sequence and print on the console the following message:
"Congrats! You have found matching elements - ${element}!"
If the player hit two different elements, you should print on the console the following message:
"Try again!"
If the player hit all matching elements before he receives "end" from the console, you should print on the console the following message:
"You have won in {number of moves until now} turns!"
If the player receives "end" before he hits all matching elements, you should print on the console the following message:
"Sorry you lose :(
              {the current sequence's state}"
Constraints
All elements in the sequence will always have a matching element.

Judge ми дава 83 точки.

Кодът ми е : https://pastebin.com/icEZWjYX

Линк към Judge: https://judge.softuni.bg/Contests/Practice/Index/2517#2



 

 

Тагове:
0
Python Fundamentals
angela9x avatar angela9x 1 Точки

Good post! We will be linking to this great post on our website. Keep up the good writing. Are you a big fan of Sonic Games like me? 

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.