Untitled

 avatar
unknown
plain_text
a year ago
978 B
3
Indexable
import random
rock = """
    _______
---'   ____)
      (_____)
      (_____)
      (____)
---.__(___)
"""
paper = """
    _______
---'   ____)____
          ______)
          _______)
         _______)
---.__________)
"""
scissors = """
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)
"""
options = {
	0:rock,
	1:paper,
	2:scissors
}
user_input = ""
while user_input != "exit":
	user_input = input("""What do you choose?
	Rock (0) Paper (1) Scissors (2): """)
	if user_input == "exit":
		break
	pc = random.randint(0, 2)
	choice = int(user_input)
	if choice >= 3 or choice <= -1:
		print("Invalid input!")
		continue
	if choice == pc:
		result = "Draw!"
	elif choice == 0 and pc == 1 or choice == 1 and pc == 2 or choice == 2 and pc == 0:
		result = "You Lose!"
	else:
		result = "You Win!"
	print(f'''You picked:
		{options[choice]} 
		Computer picked:
		{options[pc]} 
		
		{result}''')
	print('''
Type "exit" to end the game.
	''')
Editor is loading...
Leave a Comment