Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
initial_string = input().split() move_counter = 0 command = input() while command != "end": command_split = command.split() index_1 = int(command_split[0]) index_2 = int(command_split[1]) move_counter += 1 if 0 <= index_1 < len(initial_string) and 0 <= index_2 < len(initial_string): value_1 = initial_string[index_1] value_2 = initial_string[index_2] if value_1 == value_2: print(f"Congrats! You have found matching elements - {value_1}!") initial_string.remove(value_1) initial_string.remove(value_2) else: print(f"Try again!") else: print(f"Invalid input! Adding additional elements to the board") middle_point = int(len(initial_string) // 2) for el in range(move_counter): initial_string.insert(middle_point, f"-{str(move_counter)}a") if len(initial_string) == 0: print(f"You have won in {move_counter} turns!") break command = input() if len(initial_string) != 0: print(f"Sorry you lose :(") print(" ".join(initial_string))
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)