48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
import random
|
|
|
|
player1 = ["" , 0 , 0]
|
|
player2 = ["" , 0 , 0]
|
|
|
|
player1[0] = input("what's your name ? : ")
|
|
print(f"welcome, {player1[0]}")
|
|
player2[0] = input("what's your name ? : ")
|
|
print(f"welcome, {player2[0]}")
|
|
|
|
winScore = 3
|
|
|
|
def isWinning( player , wscore ):
|
|
if player[1] >= wscore:
|
|
print(f"THE BIG WINNER IS {player[0]}")
|
|
|
|
|
|
while True:
|
|
player1[2] = int( input(f"{player1[0]} give a numbers 1 - 6 : "))
|
|
player2[2] = int( input(f"{player2[0]} give a numbers 1 - 6 : "))
|
|
|
|
result = random.randint(1,6) # draw a number
|
|
|
|
if player1[2] == result and player2[2] == result:
|
|
print("YOU BOTH WIN")
|
|
player1[1] = player1[1] + 1
|
|
player2[1] = player2[1] + 1
|
|
|
|
elif player1[2] == result: # test result
|
|
print(f"{player1[0]} YOU WIN")
|
|
player1[1] = player1[1] + 1
|
|
|
|
elif player2[2] == result:
|
|
print(f"{player2[0]} YOU WIN")
|
|
player2[1] = player2[1] + 1
|
|
|
|
else:
|
|
print("YOU ALL LOOOOOOSE")
|
|
print("the good value was :" + str(result))
|
|
|
|
isWinning(player1,winScore)
|
|
isWinning(player2,winScore)
|
|
|
|
print(f"the scores is : {player1[0]} : {player1[1]} / {player2[0]} : {player2[1]}")
|
|
|
|
|
|
|