+ 4

[SOLVED] Question for Python Experts

The program below is quite long and a bit complex, it's a personal project based on Chapter 8 Exercise 15 from Starting Out with Python by Tony Gaddis, for reference. I would really love any help from Python experts on how to simplify any lines of code. This would help me become a better programmer and learn more about the Python libraries. If you wish to look up the challenge, just search up Gas Prices Tony Gaddis Python 5th Edition. Hopefully this discussion isn't too much. Keep in mind the code doesn't work on SoloLearn IDE. You can try it on PyCharm and use the GasPrices.txt file. DM if you need it, but you can also find it online. https://code.sololearn.com/cw6fe3y935pC/?ref=app

23rd Jul 2022, 2:58 AM
Chris
Chris - avatar
38 Respuestas
+ 3
Abdul rahmon I posted a link to that book here. Why not check it out?
24th Jul 2022, 6:59 PM
Oma Falk
Oma Falk - avatar
+ 5
Chris das ist dein Namensvetter, mit dem ich dich verwechselt habe.
23rd Jul 2022, 11:51 AM
Oma Falk
Oma Falk - avatar
+ 4
Chris not only this: Make a list from it with 4 rows: day,month,year,price. (ok...no pandas)
23rd Jul 2022, 8:34 AM
Oma Falk
Oma Falk - avatar
+ 4
Chris and numpy, scipy, matplotlib, django, opencv... 😁 Learn the basics. They are the foundation. Learn the modules. They are the tools. Google Python essential modules.
26th Jul 2022, 5:49 AM
Bob_Li
Bob_Li - avatar
+ 4
am glad I commented here , seeing this discussion notification keep motivating me thanks you'all
26th Jul 2022, 8:16 AM
Abdul rahmon
Abdul rahmon - avatar
+ 3
#Chris sorry for interrupting , you mentioned (Starting out with python by Tony Gaddis) in your description , as a beginner can go for that
24th Jul 2022, 4:06 PM
Abdul rahmon
Abdul rahmon - avatar
+ 3
Bob_Li yeah... that's how It will work.. But in his book, he just worked on files, strings, 2dLists... In short time this stuff is his reading.
25th Jul 2022, 6:04 AM
Oma Falk
Oma Falk - avatar
+ 3
Oma Falk Agreed. Writing it from scratch is a good way to learn how code works. But he will outgrow it sooner or later. Just giving a preview on the convenience of using modules made specifically for the task required.
25th Jul 2022, 8:33 AM
Bob_Li
Bob_Li - avatar
+ 3
kindly resend the link I think click the wrong link please
25th Jul 2022, 2:15 PM
Abdul rahmon
Abdul rahmon - avatar
+ 3
Bob_Li Damn I need to learn Pandas!
25th Jul 2022, 11:46 PM
Chris
Chris - avatar
+ 3
Chris Don't worry, it gets harder, then easier. The knowledge builds upon one another.
26th Jul 2022, 8:12 AM
Bob_Li
Bob_Li - avatar
+ 2
Chris , can you give us a sample how the file for reading from looks like. it contains date and price, but how date and price are formatted?
23rd Jul 2022, 6:33 AM
Lothar
Lothar - avatar
23rd Jul 2022, 8:24 AM
Oma Falk
Oma Falk - avatar
+ 2
There are tons of improvements, but we should take into account, you are beginner. Lisa an all our data scientists would do it in 5 lines. But... your way does the job.
23rd Jul 2022, 8:45 AM
Oma Falk
Oma Falk - avatar
+ 2
Chris Pandas have a big learning curve, but here is an idea on how to use it for your data: https://code.sololearn.com/cLZmCFVjCX90/?ref=app
25th Jul 2022, 4:49 AM
Bob_Li
Bob_Li - avatar
+ 2
Abdul rahmon It's working, at least on mobile. I downloaded it actually along with the rest. (Great link lol thanks Oma Falk) What signup are you talking about btw? That link directs you to a professor's course material directory.
25th Jul 2022, 12:37 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 2
Bob_Li And data structures and algorithms, boy do I have so much to learn.
26th Jul 2022, 6:47 AM
Chris
Chris - avatar
+ 2
Thanks you guys , I finished the course , now I understand what you posted ,thanks once more for sharing the pdf with me I'll be glad if you share more
24th Sep 2022, 5:13 PM
Abdul rahmon
Abdul rahmon - avatar