0% found this document useful (0 votes)
17 views1 page

Rock, Paper, Scissors-2

jhk

Uploaded by

basavarajuronav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

Rock, Paper, Scissors-2

jhk

Uploaded by

basavarajuronav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

# -*- coding: utf-8 -*-

"""Rock, Paper, Scissors.ipynb

Automatically generated by Colab.

Original file is located at


https://colab.research.google.com/drive/1jnasnEenEyJN_a7XYnemlmNTx8LNyJzI
"""

"""WHAT I LEARNED:

1- The return function is print but does everything

2- Variables in function are specific to the function unless specified

3- To run a definition 1. write def name 2. put () behind it

4- you can have multiple conditions for if statemnt

"""

import random

def play():
User_Choice0 = input("Type in one: rock, paper, scissors: ")
Move = User_Choice0.lower()
Computer = (random.choice(["rock", "paper", "scissors"]))
print(f"The computer chose {Computer.title()}")
if Move == Computer:
print("You Tied")
elif win(Move, Computer) == True: #----------2
print("You Win!!!!!")
else:
print("You Lose!!!!!")

def win(Move, Computer): #-----------2


if (Move == "rock" and Computer == "scissors") or \
(Move == "scissors" and Computer == "paper") or \
(Move == "paper" and Computer == "rock"):
return True #----------1
play() #----------3

You might also like