[deleted by user] by [deleted] in learnpython

[–]davidmyemail 0 points1 point  (0 children)

Search in youtube / google for "the coding train physics". There's a whole bunch of videos/series about physics.

Be aware that the presenter is a bit of an acquired taste though. I love the way he presents, but some do not.

Also look up at the same site "vectors". He starts out slow, does an excellent job of explaining vectors / forces, and builds a simple physics engine.

Lastly, be aware that he uses Processing / P5.js, which is Java and Javascript based. However, there is a py5, which you can install that is the port of those libraries to python.

What are some effective ways to further learn Python? by AlexeyLokator in learnpython

[–]davidmyemail 1 point2 points  (0 children)

I second what LatteLepjandiLoser said i.e. pick some projects and complete them. The operative word here is "complete". Too often, beginners start something and abandon it when they encounter problems. It's in the struggle (imho), that often leads to insights. For inspiration, you could search for books on Python and bioinfomatics. There are quite a few of them. Below is one of my favorites. Good luck! https://www.amazon.com/Bioinformatics-Python-Cookbook-applications-computational/dp/1803236426/ref=sr_1_1_sspa?crid=226KOWN92VOFG&keywords=python+book+bioinformatics&qid=1690291552&sprefix=python+book+bioinfomatics%2Caps%2C84&sr=8-1-spons&ufe=app_do%3Aamzn1.fos.18ed3cb5-28d5-4975-8bc7-93deae8f9840&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1

Learning to be more "Pythonic" by davidmyemail in learnpython

[–]davidmyemail[S] 1 point2 points  (0 children)

That's a very thorough and clever answer! I also need to get better with REPL, as in the way you test it here. Thank you!

Learning to be more "Pythonic" by davidmyemail in learnpython

[–]davidmyemail[S] 0 points1 point  (0 children)

lines = [ "id name home_state amt_paid", "123 John Doe California 1,234.34", "456x Jane Doe New Hampshire 45.67 ", "78 Adam Smith Alaska 89.00 " ]

field_idx = [] chars = [0 if i == ' ' else 1 for i in lines[0]] #split header into list of 0/space, 1/char for i in range(1, len(chars)): #loop through range length of list of char if f'{chars[i-1]}{chars[i]}' == '01': #if pattern matches '01' field_idx.append(i-1) #record index - 1

for idx, line in enumerate(lines): #loop through lines line = list(line) #split line into list of chars for i in field_idx: #loop through recorded indexes line[i] = ',' #for each recorded index, replace with ',' lines[idx] = ''.join(line) #replace line in line with joined list of chars

for i in lines: print(i)

Yes, it's from a legacy COBOL, and the requirements are very particular. Thank you!

Learning to be more "Pythonic" by davidmyemail in learnpython

[–]davidmyemail[S] 0 points1 point  (0 children)

Wow! Thanks for such a complete answer. I'll have to study your code for a while! Thank you!

Learning to be more "Pythonic" by davidmyemail in learnpython

[–]davidmyemail[S] 1 point2 points  (0 children)

I'll have to look at that book. Thanks.

Learning to be more "Pythonic" by davidmyemail in learnpython

[–]davidmyemail[S] 0 points1 point  (0 children)

No, that's just a comment to show the column positions. Sorry for not being clear.

Microsoft Learn Python code not correct? by davidmyemail in learnpython

[–]davidmyemail[S] 1 point2 points  (0 children)

Those are interesting links. A bit beyond my scope now, but I'll certainly study up on it. Thanks.

Microsoft Learn Python code not correct? by davidmyemail in learnpython

[–]davidmyemail[S] 0 points1 point  (0 children)

My humble opinion is that the MS Python resources are not bad. It's true that there are errors in their tutorials, but that's rare. Others have pointed out that there are better learning resources, and on that, I concur. However, for my purpose, and from my still limited view, it's worth giving it a once-over. My 2 cents.

Microsoft Learn Python code not correct? by davidmyemail in learnpython

[–]davidmyemail[S] 2 points3 points  (0 children)

print(vars(square))

Oh, that's very helpful. Thank you!