My first rock,paper,scissor game

hey guys
in the past few days ,i’ve been doing all kind of beginners exercises about python
and i finally decided to do a small project whitch is rock,paper,scissor game
my code is this

import random
name=input('hey what is your name \n>')
print('okay ',name,"let's play")
moves=['rock','paper','scissor']
win_cond=['rockscisor','scissorpaper','paperrock']
comp_move=moves[random.randint(0,2)]

move=input('>')
if move==comp_move:
    print('your move is',move,' and the computer move is ',comp_move)
    print('draw')
elif move+comp_move in win_cond:
    print('your move is', move, ' and the computer move is ', comp_move)
    print('you win')
elif move+comp_move not in win_cond:
    print('your move is', move, ' and the computer move is ', comp_move)
    print('you lose')

is there anything i m missing or should try better?
thank you

Nice job!

Careful with this mispelling ^^^

This also happens 3 times in a row:
print('your move is',move,' and the computer move is ',comp_move).

You could probably just have a function and call it once before the conditionals (since it has nothing to do with the condition) instead of 3 times. Conceptually, this type of refactoring is useful when things scale up.

1 Like