diff --git a/Python/task/py_ss.png b/Python/task/py_ss.png new file mode 100644 index 00000000..5bd08bca Binary files /dev/null and b/Python/task/py_ss.png differ diff --git a/Python/task/python task done b/Python/task/python task done new file mode 100644 index 00000000..cd6c7304 --- /dev/null +++ b/Python/task/python task done @@ -0,0 +1,32 @@ +import random + +player1 = 0 +player2 = 0 +goal = int(input("Enter the goal:\n")) + +while (player1 < goal) and (player2 < goal): + input("Player 1 - Hit Enter to roll Dice!") + d1 = int(random.randint(1, 6)) + player1 = player1 + d1 + print(d1) + if player1 > goal: + player1 = player1 - d1 + if player1 == goal: + print("Player 1 Wins the Game!") + break + + input("Player 2 - Hit Enter to roll Dice!") + d2 = int(random.randint(1, 6)) + player2 = player2 + d2 + print(d2) + if player2 > goal: + player2 = player2 - d2 + if player2 == goal: + print("Player 2 Wins the Game!") + break + + print("Player 1 Score: ", player1) + print("Player 2 Score: ", player2) +© 2022 GitHub, Inc. +Terms +Privacy