Build Class objects from list elements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Build Class objects from list elements

I know this is a learning app but I know there are some pretty advanced coders here so I'm asking for your help. I'm trying to build a River class from list elements but I can't figure it out. I live near a river and I'm working on an alert system from the waterdata.gov website. Here is the code I'm working on: https://code.sololearn.com/cScSMMIlC3Yi/?ref=app. As you can see it only returns the generator object. And Here is what I want it to do: https://code.sololearn.com/cvi2CJn9zSCf/?ref=a Thanks!!

22nd May 2017, 1:38 AM
Aaron Nelson
Aaron Nelson - avatar
4 Answers
+ 4
I am not good at English, so I did not understand what you wanted. How about code below? https://code.sololearn.com/cV1RgG89aF62/?ref=app
22nd May 2017, 2:32 PM
Suyasa
Suyasa - avatar
+ 5
I tried creating a simple instance original code : station = ([(River(rivers[n], stages[n], floods[n], action[n])]) fixed code: station = River(rivers[n], stages[n], floods[n], acction[n]) I think that putting an instance in the list Also, there were a few simple syntax mistakes. I am sorry. In my poor English, I can only explain this much
22nd May 2017, 2:58 PM
Suyasa
Suyasa - avatar
+ 2
no worries I understand. I was able to see where I messed up by looking at your code too. :)
22nd May 2017, 3:55 PM
Aaron Nelson
Aaron Nelson - avatar
+ 1
THANK YOU!!!! So all I was missing is the action class and the function you added? could you explain a little where I messed up?
22nd May 2017, 2:34 PM
Aaron Nelson
Aaron Nelson - avatar