I've started with Python recently, reading a book.
Unfortunately, I've come through an error I do now know how to resolve.
If you could please help me, it would be greatly appreciated.
That is the code, that will (in the future) simulate a fight. At the moment, what I am trying to do is check if the monster starts with a vowel so that instead of "a Orc" it says "an Orc", which is correct.
I have tried with these ( | ) signs and with the or keyword, but none of them worked.
Unfortunately, I've come through an error I do now know how to resolve.
If you could please help me, it would be greatly appreciated.
Code:
from random import randrange #Simulates a fight monsters = [ 'Goblin', 'Orc', 'Human', 'Soldier', 'Fighter', 'Night Elf' ] rnd = randrange(0, 5) x = monsters[rnd] i = 0 while i <= range(len(monsters)): [B]if monsters[i].startswith('a' | 'e' | 'i' | 'u' | 'o'):[/B] an = 'an ' i += 1 else: an = 'a ' i += 1 print "You are fighting " + an + x
I have tried with these ( | ) signs and with the or keyword, but none of them worked.
Comment