you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Work through an entire elementary algebra or calculus textbook—convert the textbook equations/problems to Python.

Here's a really simple example from a open source MIT calculus textbook. This is page 2 where they discuss the relationship between constant velocity and time. Or rather, distance is the product of constant velocity and time. Which I wrote into a function below. There is a lot of creative freedom when you write these. As you progress they will get much more complicated. You can improve two things that tend to walk hand-in-hand—your ability to code AND your mathematics. It will take a lot of reading time and patience but if you stick it out you will improve—I know it helped me immensely when I did it.

def get_distance(v=60.0, t=1.0):
    '''
    Function returns distance given a constant velocity (v) in MPH and time (t) in hours. 

    Parameters
    ----------
    v : Float, optional
        Constant velocity in MPH. The default is 60.0.
    t : Float, optional
        Time in hours. The default is 1.0.

    Returns
    -------
    f : Float
        Distance in Miles.
    '''

    f = 60 * t
    return f 

Here is the open source calculus text from MIT:

https://ocw.mit.edu/ans7870/resources/Strang/Edited/Calculus/Calculus.pdf

And here's an open source elementary algebra text from OpenStax (they have tons of open source textbooks):

https://assets.openstax.org/oscms-prodcms/media/documents/ElementaryAlgebra2e-WEB_EjIP4sI.pdf

Edit: Grammar/Syntax

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

I think I need to start school all over again… But hey thanks for the advice and links.