import random
class Dice:
def roll(self):
First = random.randit(1, 6)
Second = random.randint(1, 6)
return First, second
dice1= Dice()
dice1.roll()
Asked
Active
Viewed 182 times
-3

Sayse
- 42,633
- 14
- 77
- 146
-
Pls I need answers urgently – Ezimoha Obichukwu Apr 19 '21 at 09:52
-
Pls how can I add two players name to it – Ezimoha Obichukwu Apr 19 '21 at 09:59
-
Seems you are able to start but not clear what your issue is in completing your code. Have you tried searching on stackoverflow for dice games i.e. web search using **python stackoverflow dice game** to get ideas? You may benefit from these previous questions & answers. – DarrylG Apr 19 '21 at 10:00
-
Thanks for the info I am new at stackoverflow – Ezimoha Obichukwu Apr 22 '21 at 03:32
1 Answers
0
You haven't given a good description of what you are trying to do here, but based on my assumptions you might want something like this:
import random
class Player:
# initialize a player class with name of player
def __init__(self, name):
this.name = name
# Roll dice method
def roll(self):
First = random.randit(1, 6)
Second = random.randint(1, 6)
return First, second
player1 = Player("Alice")
player1.roll()
player2 = Player("John")
player2.roll()

Tom Walsh
- 119
- 2
- 12