This forum is now read-only. Please use our new forums at discuss.codecademy.com.

How to use APIs with Python Forum

View Course » View Exercise

1122 points
Picture
Submitted by
Luis Villamarin
over 4 years ago

Oops, try again. Make sure that you provide the answer as a string in quotation marks.

No matter what choice I mark, it is returning always an error saying:

Oops, try again. 
Make sure that you provide the answer as a string in quotation marks.

I have used "" or '' and still I get the same error.

I am getting this same error with all the exercises of this kind.


3 votes

permalink

try putting the response as

answer = str (" answer ")

that seems to fix it for me

803 points
187c8886e1bf25bf24828afd8f06964a?s=140&d=retro
Submitted by
Jonatan Arellano
over 4 years ago

5 Comments

Picture Luis Villamarin over 4 years ago

Solved! Thanks

Picture Lyndsey Bain McCollam over 4 years ago

Oh for Pete's sake. Works for me too but how the heck were we supposed to know that?

Picture Ian Crosby over 4 years ago

Seriously. Fix this guys!

501c279f28e19000020169ce_91422859 Fletcher Heisler over 4 years ago

It should work as intended now without having to use the str() function. This was an issue caused by a change Codecademy made to support international users.

501c279f28e19000020169ce_91422859 Fletcher Heisler over 4 years ago

It should work as intended now without having to use the str() function. This was an issue caused by a change Codecademy made to support international users.


2 votes

permalink

There seems to be a bug with the 'type' for string literals. They're returning type 'unicode', not only in this exercise but many if not all other Python exercises.

Try this in scratchpad:

print type( 'example' )
print type( str('example' ) )

Anything in validation checking for 'str' as the type will fail to match 'unicode', though not the fault of the validation code. Using str() corrects the type so keeps validation happy.

5530 points
85bec28e2900d31a3d79742b912776b0?s=140&d=retro
Submitted by
pTd
over 4 years ago

1 Comment

85bec28e2900d31a3d79742b912776b0?s=140&d=retro pTd over 4 years ago

It seems the unicode typing is deliberate in order to accommodate accented characters, so it's not a bug, but I guess validation site-wide will need updating.


0 votes

permalink

This still does not work, I've also tried all possible solutions from 'JSON' "JSON" answer = str("answer") answer = u"answer", EVERYTHING!! This course needs to be fixed by the course creator.

2546 points
51394d0fb16a1d8b010007f0_305452763
Submitted by
Jon Becher
almost 4 years ago

4 Comments

85bec28e2900d31a3d79742b912776b0?s=140&d=retro pTd almost 4 years ago

I've just had another look at ex.19 and it passes fine using: answer = 'JSON'. For what it's worth I've quickly run all 20 exercises without any problems, all passed without needing to use workrounds. The only problem I have is the same for all Python and Ruby courses - the page times out some 10-20 secs after loading and will not submit the exercise thereafter, without copying my code, refreshing the page, then quickly pasting back before it times out again! Are you at least getting a error response?

51394d0fb16a1d8b010007f0_305452763 Jon Becher almost 4 years ago

Yes I get an error response, but I've tried doing it very fast and nothing, still get the same error. Like I've said I've tried answer = 'JSON' and everything else that has been suggested and still nothing.

85bec28e2900d31a3d79742b912776b0?s=140&d=retro pTd almost 4 years ago

One other thing I found early on was that my ISP (T-Mobile, UK) uses web 'acceleration' by default, which often screwed up complex coding. Soon as I found how to turn it off, the problems went away, (except for the timeouts). Its worth considering if your own ISP does this.

51394d0fb16a1d8b010007f0_305452763 Jon Becher almost 4 years ago

I'll check it out, thank you for the suggestion.