Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want to get random number from 1 to 6 whenever i run this but i only get 1. from random import randint class die
I want to get random number from 1 to 6 whenever i run this but i only get 1.
from random import randint
class die : def __init__(self): self.value = 1
def roll(self): self.value = randint(1,6)
def getvalue(self): return self.value
def __str__(self): return("the number on the die is {}".format(self.value))
t = die()
print(t)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started