+ 10
Reading CSV database on Py.
I want to randomly generate 5 numbers. and then based on those 5 numbers, get the questions, answers and marks corresponding to that number from the database. the columns on the database go as follow: number/question/answer/marks. all the database contains is 10 data rows on those headings. I want an overview of what kinda things I should include with maybe some examples. https://code.sololearn.com/cHT3zwdeMrv7/?ref=app Thanks
9 Answers
+ 11
I have no idea how to deal with csv in Python. According to what I read for 5 minutes online, it appears that
number = row["Numbers"]
would return a dict and store it in number. If that is the case, I suppose you can use your generated random number and access the dict via index.
Hopefully someone with better knowledge of Python comes across this.
+ 5
Hatsy Rei more than helpful. I'll see if I can implement that. I saw a bid on sentdex on this I think . I got the questions working and the whole user input and checks it against the answer in database. it's just the random gen that I have to fix. I'll upload the updated in a while and maybe u can check it out and give some advice
thanks😗
+ 4
Hmmm this will prove useful to me :)
+ 4
and I hope it does prove useful
+ 4
I learnt how to handle CSV files with java. Finally I found how to do it with Python.
Except,
my Excel like the rest of my Office 2016 is screwed up
+ 4
ah OK 😂what a bugger. it is quite annoying. if u need help I might be able to impart some penny advice
+ 4
Sure. I am doing this for my Discord bot to store data with ease
+ 3
Pegasus [Random Q&A posting only] I don't mind u looking at it to get an idea but pls don't like spread it around on the Internet. they'll say that I plagiarised it then cos it's for an assignment and I'm stuck on it. thanks😚
+ 2
noice. hope u get it working beautifully. if I can get it working I'll send it to so u can use it as template. good luck bab