TekBots

This bulletin board will help connect the developers and supporters of TekBots with users from OSU and other schools.
It is currently Mon Nov 24, 2014 2:23 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Codecademy 8/13
PostPosted: Tue Nov 26, 2013 10:19 pm 
Offline

Joined: Tue Nov 26, 2013 10:10 pm
Posts: 2
If anyone is on this level or past it, I could use some help. I've been over it a bunch and can't figure out what's wrong. It's outputing what it asks for, but still gives me a message saying that it's not correct and I can't proceed.

Here is my code:

prices = {"banana":4, "apple":2, "orange":1.5, "pear":3}
stock = {"banana":6, "apple":0, "orange":32, "pear":15}

for x in prices and stock:
print(x)
print("price: " +str(prices[x]))
print("stock: " +str(stock[x]))


(of course the three print statements are indented into the 'for' loop)

And this is what it tells me:

"Oops, try again! You should need exactly three print statements!"

Although the output is what it says it wants. Any help would be greatly appreciated. Thanks


Top
 Profile  
 
 Post subject: Re: Codecademy 8/13
PostPosted: Sat Nov 30, 2013 5:18 pm 
Offline

Joined: Wed Oct 16, 2013 12:01 pm
Posts: 4
For some reason, even though the code looks right, Codecademy doesn't like your parentheses in the print statements. If you do it like this, it will work

for x in prices:
print x
print "price: " + str(prices[x])
print "stock: " + str(stock[x])


I think the problem is in the way the lesson was written.

Cheers,
Gabriel


Top
 Profile  
 
 Post subject: Re: Codecademy 8/13
PostPosted: Sun Dec 01, 2013 12:50 pm 
Offline

Joined: Tue Nov 26, 2013 10:10 pm
Posts: 2
Thanks it worked! Thought I had tried everything.. Thanks a lot.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group