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

The NPR API Forum

View Course » View Exercise

1628 points
51584a8252d9a6b5fe001672_849314539
Submitted by
Shawn McClearn
over 5 years ago

"Did you declare npr_id, search_string, and feed_title?"

Here's what I have coded for this exercise:


nprid = rawinput('Enter comma-seperated NPR IDs or leave blank.')
searchstring = rawinput('Enter your search string or leave blank')
feedtitle = rawinput('What's your feed title?')
if nprid or searchstring:
raw_input('Hit enter to download your podcast.')
else:
print "you must enter an NPR ID, a search term or both."


And the reply I get is "Did you declare nprid, searchstring, and feed_title?"

I have tried resetting and rewriting this and it hasn't made any difference. I still get this message. Help!


2 votes

permalink

please use the code indent button to format code as code:

alt text

5570 points
Picture
Submitted by
Aleksandrs ÄŒudars
about 5 years ago

1 Comment

52a5ca83631fe988e3001586_230208821 agua305 about 4 years ago

yes, please do this people its very annoying when you don't.


2 votes

permalink

this worked for me :)

npr_id= raw_input("Enter comma-separated NPR IDs or leave blank.")
    search_string = raw_input("Enter your search string or leave blank.")
    feed_title = raw_input("What's your feed title?")

    if npr_id or search_string == True:
        raw_input("Hit Enter to download your podcast.")
    else:
        print "You must enter an NPR ID, a search term, or both."

422 points
5130e01ee984fc7bda00ca7d_553095335
Submitted by
Eyad Essam
about 5 years ago


1 vote

permalink

Hi I think you should get a syntax error instead as I believe you have an escaping issue on this line.

feedtitle = rawinput('What's your feed title?')

you have a single quote in the middle of the what's your feed title, if you wrap that in double quotes you can then leave the single quote inside.

I am no expert just learning also but I hope that helps you out?

s

599 points
Picture
Submitted by
sachlar
over 5 years ago

2 Comments

51584a8252d9a6b5fe001672_849314539 Shawn McClearn over 5 years ago

I actually went back and retyped everything just to be doubly sure. That may have been the difference maker. Still, I appreciate the help. I hope the lessons have been treating you well. Thanks!

502fc1b40b7a7d0002038d87_215953693 Infant Joecharles almost 5 years ago

Its raw_input, not rawinput. you are missing an underscore


0 votes

permalink

my answer

npr_id = raw_input("Enter comma-separated NPR IDs or leave blank.")
search_string = raw_input("Enter your search string or leave blank.")
feed_title = raw_input("What's your feed title?")

if npr_id or search_string:
    raw_input("Hit Enter to download your podcast.")
else:
    print "You must enter an NPR ID, a search term, or both."

url += '&numResults=3&action=Or&requiredAssets=audio&format=Podcast' + npr_id + search_string`

187 points
543edf1a52f86387d600034e_60487159
Submitted by
Allium Giganteum
over 3 years ago