We can figure out that when John walks, it takes him 20 minutes to complete one mile. Therefore, you can start your equation with T = 20wT=20w, which will tell you how long John spends walking.
To figure out how long John spends running, you then need to find out how many miles he runs by subtracting ww, the miles he does not run, from 2020, the total miles. Because we don't know what ww is, we can leave this as an expression. Finally because we can figure out that it takes John 10 minutes to run a mile, so we can multiply 10*(20-w)10⋅(20−w) and add this on to our equation, giving us T = 20w + 10(20-w)T=20w+10(20−w), or when simplified, T = 10w +200T=10w+200
Another way to solve this equation would be to calculate how long it would take for John to run the entire course by doing 2020 miles times 1010 mph to get 200. Then, because it takes him 1010 minutes longer to walk one mile than to run it, you can simply add 1010 minutes for every mile that he walks, leading you to the same final equation of T = 10w +200T=10w+200.