Rock
Rock
while True:
if len(user_data) > 0:
fr = user_data.count('rock')/len(user_data)
fp = user_data.count('paper')/len(user_data)
fs = user_data.count('scissors')/len(user_data)
temp = []
back = 0
sigma = [fr,fp,fs]
if user_data[-1:] == 'rock':
temp.append(1)
temp.append(0)
temp.append(0)
elif user_data[-1:] == 'paper':
temp.append(0)
temp.append(1)
temp.append(0)
else:
temp.append(0)
temp.append(0)
temp.append(1)
for f in range(len(sigma)):
temp += sigma[f]*temp[f]
if pilnya == fr:
cpu_choice = 'rock'
elif pilnya == fp:
cpu_choice = 'paper'
else:
cpu_choice = 'scissors'
else:
cpu_choice = random.choice(choices)
print()
print("Your choice:", user_choice)
print("Computer's choice:", cpu_choice)
print()
if user_choice == 'rock':
if cpu_choice == 'rock':
print("It's a tie!")
elif cpu_choice == 'scissors':
print("You win!")
user_wins+=1
user_data.append('rock')
elif cpu_choice == 'paper':
print("You lose!")
computer_wins+=1
com_data.append('paper')
elif user_choice == 'paper':
if cpu_choice == 'paper':
print("It's a tie!")
elif cpu_choice == 'rock':
print("You win!")
user_wins+=1
user_data.append('paper')
elif cpu_choice == 'scissors':
print("You lose!")
computer_wins+=1
com_data.append('scissors')
elif user_choice == 'scissors':
if cpu_choice == 'scissors':
print("It's a tie!")
elif cpu_choice == 'paper':
print("You win!")
user_wins+=1
user_data.append('scissors')
elif cpu_choice == 'rock':
print("You lose!")
computer_wins+=1
com_data.append('rock')
print()
print("You have "+str(user_wins)+" wins")
print("The computer has "+str(computer_wins)+" wins")
print()
if repeat == 'n':
print("Bye bye")
break
print("\n----------------------------\n")