mardi 9 mars 2021

Randint generating 0s when I set it to be a range of 1-3

I posted here yesterday to ask a question about a Rock Paper Scissors game I made in Python. However, I am having another problem with it. For some reason, my function to generate the computer's choice for the game isn't working right. I am using random.randint to generate a number between 1-3, and it keeps generating a 0. Here is my code that this function would be using.

import random as rand
import math
from random import seed
from random import randint
from random import random

computerAnswer = 0

def generateAnswer():
    computerAnswer = rand.randint(1,3)
    results()

Anyone know why it is doing this?



Aucun commentaire:

Enregistrer un commentaire