Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Python/task/python task done
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import random

player1 = input("Enter name of 1st player ")
player2 = input("Enter name of 2nd player ")
target = int(input("Enter target number: "))
score1 = 0
score2 = 0
list= [1,2,3,4,5,6]
while True:
if (score1 < target) and (score2 < target):
input(f"{player1} Roll Dice")
dice1 = int(random.choice(list))
print(f"Dice rolled: {dice1}")
score1 = score1+dice1
input(f"{player2} Roll Dice")
dice2 =int((random.choice(list)))
print(f"Dice rolled: {dice2}")
score2 = score2+dice2
print(f"{player1}'s Score: {score1}\n{player2}'s Score: {score2}")
if score1 > target:
score1 = score1-dice1
if score2 > target:
score2 = score2-dice2
if score2 == target:
print(f"{player2} has won")
break
if score1 == target:
print(f"{player1} has won")
break
Binary file added Python/task/screenshot_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Webdevelopment/task1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@