+ 2

Me, again(NEEDS HELP)

Guys, I need to make the function choose the pokemon but I dont know how to. Here goes the code(btw IDRs will be filled later): #Input progin=input("Enter the Pokemon's Name or Pokemon's Dex No: ") #Pokemon Info bulbasaur: { pokename="Bulbasaur" poketype="Grass, Posion" pokeweak="IDR" pokeresist="IDR" pokevolve="IDR" } def ivysaur(): poketype=0 pokeweak=0 pokeresist=0 pokevolve=0 #Output def decor(): print("===============================") def pokeinfo(): print("Pokemon's Name: "+pokename) decor() print("Pokemon's Dex No: ") print("Pokemon Type(s): "+poketype) print("Pokemon's Weakness(es): "+pokeweak) print("Pokemon's Resistance(s): "+pokeresist) print("Pokemon's Evolution: "+pokevolve) decor() pokeinfo() #test #Input Analizing if progin=="bulbasaur" or progin=="Bulbasaur" or progin=="1": pokeinfo()

9th Jan 2017, 9:44 AM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
3 odpowiedzi
+ 2
Try to study and be inspired by this work: https://code.sololearn.com/clKlAuiLUF38 ( which is a correction/improvment for another member, but contains probably useful ideas for your problem ;) )
9th Jan 2017, 10:11 AM
visph
visph - avatar
+ 2
@visph I tried to make it work but it gave EOFError
9th Jan 2017, 12:03 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 2
Oh, yes... If you study the code, you will notice that multiple input are attended... so at least 2, and the last must to be 'quit" ( case insensitive ): in codeplayground, there is no local execution of code, but distant, on server, and input/output are virtualized ( and cannot be use interactively ). You will be prompted for entering ALL the entries the code needs in once, each one separate by a new line, then validate... However, the idea was to inspire you after studying the code... the purpose was not to demonstrate anything :P So, with dict structure ( paired key/value lists ), you can index your list of variable with name... Else, for your question about how make your function choose the pokemon, we need at least to know evaluation criteria for consider if we can help you in designing a solution ( data structure is most often as important as algoritm, and could need to be reorganized, in regards of searched purpose )
9th Jan 2017, 7:19 PM
visph
visph - avatar