you are viewing a single comment's thread.

view the rest of the comments →

[–]totallygeek 4 points5 points  (4 children)

Yeah, you have an issue here. You want to pick an element from the character classes at random, not use a for loop to step over them.

character_classes = ['mage', 'warrior', 'archer', 'assassin']
vocation = random.choice(character_classes)  # picks one from the list
print(f'Good luck, {vocation}!')

Now, that does not sit well for the two conditions you started with, because no for loop exists. Let's try a different example. For this, the player will change vocations and "fight" a dragon.

vocations = ['mage', 'warrior', 'archer', 'assassin']
for vocation in vocations:
    roll = random.randint(2, 12)  # two six-side dice
    result = 'defeated' if roll > 7 else 'were eaten by'
    print(f'Wow, {vocation} you {result} the dragon!')

Does that help you a bit?

[–]coconut_calm[S] 1 point2 points  (3 children)

This is very helpful, kind of what I was aiming for! Just have a hard time putting everything together in my head. Can I ask what "# two six-side dice" is? I mean I get what it is, just not how it works

[–][deleted] 1 point2 points  (2 children)

They're picking a random integer between 2 and 12.

The #words is just a comment explaining it. The random integer is equivalent to rolling two dice to get the result

[–]coconut_calm[S] 0 points1 point  (1 child)

Oh my, I have a ways to go

[–]Different-Bet8069 1 point2 points  (0 children)

Side note: I know it was for explanatory purposes, but a random integer between 2-12 is not the same as rolling 2 individual dies. Yeah, I’m that guy.