I am making an Oregon Trail remake, and I have a list called people_alive
that is supposed to only have the people that are alive. In order to be taken off that list, you need to get the players health from 25 to 0. One way to do that is if they get sick.
cholera = random.randint(1,100)
if cholera == 1:
person = random.randrange(people_alive)
if person == p1:
p1hp -= 1
if person == p2:
p2hp -= 1
if person == p3:
p3hp -= 1
if person == p4:
p4hp -= 1
if person == p5:
p5hp -= 1
print('{} has cholera'.format(person))
input()
It gives me an error right here: person = random.randrange(people_alive)
here is the error:
Traceback (most recent call last):
File "main.py", line 149, in <module>
person = random.randrange(people_alive)
File "/usr/lib/python3.8/random.py", line 210, in randrange
istart = _int(start)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
And here is the list:
people_alive = [p1, p2, p3, p4, p5]
Aucun commentaire:
Enregistrer un commentaire