Open SohailAliCodes opened 4 years ago
after this command, "stock, bid_price, ask_price, price = getDataPoint(quote)" put "prices[stock] = price". worked for me.
Tried your style got error --> KeyError : 'DEF '
Hey Arvind, i think you forgot to put one parenthesis in the last line it should be: print ("Ratio %s" % (getRatio(prices['ABC'], prices['DEF']))). hope this solves your problem
Thanks, it works.
key error 'ABC' ..please help me
here is my code that works: add prices[stock] = price after stock, bid_price, ask_price,price = getDataPoint(quote) as suggested by Tkapil1917
still getting this problem using python2
same problem
still getting this problem using python2
Hello, there. The "stock, bid_price, ask_price, price = getDataPoint(quote)", "prices[stock] = price" , and "print ("Quoted %s at (bid:%s, ask:%s, price:%s)" % (stock, bid_price, askprice, price))" should be inside the for loop of "for quote in quotes". Remember to indent them. One last thing is the " print ("Ratio %s" % getRatio(prices['ABC'], prices['DEF']))" should be inside of the "for in xrange(N):".
same problem
"DEF" is not defined because key have not been set up yet inside of the "for quote in quotes:". However, you can fix this by moving the "print ("Ratio %s" % getRatio(prices['ABC'], prices['DEF']))" to outside of the "for quote in quotes:".
Issue: Getting this error after writing the instructed code Browser: Google Chrome Version 83.0.4103.106 (Official Build) (64-bit)