Hello, all. I'm totally new to python. I'm trying to type a small project related to the above subject
import random
option = ["rock", "paper", "scissors"];
pc_selection = ["rock", "paper", "scissors"];
pc_move = random.choice(pc_selection)
#-------------------------------------------------------------------------------
def first_condition():
select = raw_input("Please select your choice\n")
print "Your choice:", select
if select in option:
pc_move
print "Computer choice:", pc_move
else:
first_condition()
if select == pc_move:
print "Result: draw"
elif select == "rock" and pc_move == "paper":
print "Result: Computer wins"
elif select == "paper" and pc_move == "scissors":
print "Result: Computer wins"
elif select == "scissors" and pc_move == "rock":
print "Result: Computer wins"
elif select == "rock" and pc_move == "scissors":
print "Result: You win"
elif select == "paper" and pc_move == "rock":
print "Result: You win"
elif select == "scissors" and pc_move == "paper":
print "Result: You win"
first_condition()
I realized that my code aren't exceptionally effective (quickest and cleverest), so my inquiry is:
Which part might I be able to correct to make my undertaking as most limited as conceivable without losing its functionality, for example utilizing different functions that could lessen the length of my code?