I can’t find a way to get my dice simulator to convert a function to a string to an integer. I’ve been trying to incorporate a ‘how many sides’ plus ‘how many rolls’ feature, and I can’t figure it out.
def n():
for counter in range(1, r2):
random.randint(1, b)
n2 = n()
n2 = str(n2)
n2_int = int(n2)
n2_int = int(n2_int)
print('You rolled a', n2_int)
Although to be fair, I am a relative noob to python, having put it down for about 2 years.
I’ve used ChatGPT to solve it, but it hasn’t helped, and have spent a while on stack overflow trying to fix it. Still displays variants of ‘TypeError: Int() argument must be a string’ and ‘ValueError: Invalid literal for int() with base 10: ‘None’
a guy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.