Hi, is there a better way to do this ? (*heros are Character*)
herosAll = [
Character(0,"Chris","Soldat fort",type[0],15,5,8,50,1),
Character(1,"Antaa","Soldat moins fort",type[0],15,5,8,50,1)]
def HeroExist(HerosName):
herosId = -1
for heros in herosAll:
if HerosName in heros.name:
herosId = heros.id
if herosId != -1:
return herosId
else:
return -1
I find this solution myself and I think a better one exist..
HerosName=input("Enter heros name : ")
if Character.HeroExist(HerosName) != -1:
herosAll[Character.HeroExist(HerosName)].DisplayCharacterInfos()
else :
print ('This heros does\'nt exist')
Display_menu()
Ty :)
--
Brookes Christopher.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor