Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Python my code its not working

Status
Not open for further replies.

tomecarr

New Coder
#rock paper scissors gmae python
import random
import time

rock=1
paper=2
scissors=2

name ={rock: "Rock", paper: "Paper", scissors: "Scissors"}
rules ={ rock: scissors, paper: rock, scissors: paper }

player_score=0
computer_score=0

def start():
print("Let's play the game of rocks scissors paper")
while game():
pass
scores()

def game():
player=move()
computer = random.randint(1,3)
result=(player, computer)
return play_again()

def move():
while True:
print
player = input("Rock=1\Ppaer=2\Scissors=3\Make a move:")
try:
player=int(player)
if player in (1,2,3):
return player
except ValueError:
pass
print ("Opss! Please enter 1, 2 or 3")

def reslut(player, compputer):
print("1...")
time.sleep(1)
print("2...")
time.sleep(1)
print("3!")
time.sleep(0.5)
print("Computer threw {0}!").format(names[computer])
global player_score, computer_score
if player_score==computer_score:
print("Tie game!")
else:
if rules[player] == computer:
print("Your victory has been assured")
player_score +=1
else:
print("Loser")
computer_score +=1

def play_again():
answer= input("Queres jogar outra vez? y/n:")
if answer in ("y", "Y", "Yes", "sim", "claro"):
return answer
else:
print("thank you for playing out game")

def scores():
global player_score, computer_score
print("High Scores")
print("player:",player_score)
print("computer:",computer_score)

if name == '_main_':
start()
 
Status
Not open for further replies.

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom