Why is it throwing an error on me?
Hey there!Everyone hope you are having a good day
Now, i am updating ths post as due to some help from @Coder100 and @Codejira and due to some of my own changes i am able to function the program but now another problem comes,now the program is not reading the block from line 193 to 200..it is giving me a blank list at the end or None..
So please help me..
Any help would be appreciated :)
Before choosing a nickname, assign
fp2 = fp. I suggest line 184.
Line 193 can be deleted then.
This is not tested, but I think it should do the trick.
You have to change some
Where you wrote
if fp==("1" or "Charmander"): I believe
if fp == "1" or fp == "Charmander": is what you want.
if elif block on lines 192 - 200 the conditions never evaluate to
True. That's why
rfp never gets a value assigned, resulting in the
NameError: name 'rfp' is not defined a little later.
Also pay attention to capitalization:
"charmander" are two different strings and
"Charmander" == "charmander" evaluates to `False'.
@ROCKINGRAYQUAZA I think I may have found the error.
You checked if fp was 1/2/3/charmander/bulbasaur/squirtle, however, the first letter is not capitalized! Therefore fp will never be the same as what you checked for because of the first capital letter.
I forked this repl and fixed the error: forked repl
I hope this helps!
@ROCKINGRAYQUAZA, you decide what input is allowed. If you accept both
"charmander", you can take care of capitalization with the
Personally I favour the numbers-only-approach, because you can never overestimate a users stupidity ;)
Think of "ChArMaNdEr", "Charmendar", ...
not to talk about 1 versus 10 keystrokes.
But I'm afraid I found another bug:
When you enter a nickname it gets assigned to
fp on line 187. Therefor in the last
if else block no condition will ever be
True and no name will be appended to the
[None] on the last output-line is the empty
rival_team list (although I wonder if it should read
Solution. I changed the if statement because currently it's not going to work
Another way to do it is to use
bro i did what you asked but still its providing me
[''] and the program is completely refusing to check the if..else block between line 194 and 200 i have been redoing the program so i was checking it line by line for errors so i eraser a few lines from
rival_first_pokemon section so if you run the program now enter only 1 for now @Coder100