lotto game
This commit is contained in:
32
dice.py
32
dice.py
@@ -1,43 +1,37 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
player1 = ["" , 0 ]
|
player1 = ["" , 0 , 0]
|
||||||
player2 = ["" , 0 ]
|
player2 = ["" , 0 , 0]
|
||||||
|
|
||||||
player1[0] = input("what's your name ? : ")
|
player1[0] = input("what's your name ? : ")
|
||||||
print(f"welcome, {player1[0]}")
|
print(f"welcome, {player1[0]}")
|
||||||
player2[0] = input("what's your name ? : ")
|
player2[0] = input("what's your name ? : ")
|
||||||
print(f"welcome, {player2[0]}")
|
print(f"welcome, {player2[0]}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
winScore = 3
|
winScore = 3
|
||||||
|
|
||||||
def isWinning( score , wscore ):
|
def isWinning( player , wscore ):
|
||||||
if score[1] >= wscore:
|
if player[1] >= wscore:
|
||||||
print(f"THE BIG WINNER IS {score[0]}")
|
print(f"THE BIG WINNER IS {player[0]}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user1Val = input(f"{player1[0]} give a numbers 1 - 6 : ")
|
player1[2] = int( input(f"{player1[0]} give a numbers 1 - 6 : "))
|
||||||
user1Val = int(user1Val) # convert to int
|
player2[2] = int( input(f"{player2[0]} give a numbers 1 - 6 : "))
|
||||||
user2Val = input(f"{player2[0]} give a numbers 1 - 6 : ")
|
|
||||||
user2Val = int(user2Val) # convert to int
|
|
||||||
|
|
||||||
result = random.randint(1,6) # draw a number
|
result = random.randint(1,6) # draw a number
|
||||||
|
|
||||||
if user1Val == result and user2Val == result:
|
if player1[2] == result and player2[2] == result:
|
||||||
print("YOU BOTH WIN")
|
print("YOU BOTH WIN")
|
||||||
player1[1] = player1[1] + 1
|
player1[1] = player1[1] + 1
|
||||||
player2[1] = player2[1] + 1
|
player2[1] = player2[1] + 1
|
||||||
|
|
||||||
|
|
||||||
elif user1Val == result: # test result
|
elif player1[2] == result: # test result
|
||||||
print("USER 1 YOU WIN")
|
print(f"{player1[0]} YOU WIN")
|
||||||
player1[1] = player1[1] + 1
|
player1[1] = player1[1] + 1
|
||||||
|
|
||||||
elif user2Val == result:
|
elif player2[2] == result:
|
||||||
print("USER 2 YOU WIN")
|
print(f"{player2[0]} YOU WIN")
|
||||||
player2[1] = player2[1] + 1
|
player2[1] = player2[1] + 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user