Python How does one assess progress when learning a programming language?

AI Thread Summary
Learning a programming language, such as Python, involves practical application through coding rather than solely theoretical understanding. The discussion emphasizes that true learning is demonstrated by the ability to write functional programs. A key point raised is the difference between academic success, like receiving an A in a class, and actual proficiency in coding. Many participants suggest that engaging in projects, especially those related to one's field of study, can solidify understanding and skills. For example, physics majors can benefit from coding simulations of physics problems. The conversation highlights the importance of hands-on experience, such as creating programs that solve specific problems or handle user input, as a way to gauge one's knowledge of a language. Writing programs that incorporate various programming concepts, such as loops and conditionals, is recommended. Additionally, participants suggest utilizing resources like books and online platforms to enhance learning. Ultimately, confidence in knowing a programming language comes from the ability to create and modify programs, rather than just completing coursework.
dpatnd
Messages
64
Reaction score
20
I'm a physics major (Junior) who would like to learn a programming language. Many suggest Python as a good starting language, so let's suppose that is the language I want to first learn. This isn't for employability or general usefulness; rather, I'm just curious.
How exactly does one go about "learning" a programming language and how does one determine what has actually been "learned"? When can you say you "know" a given language? The issue is that I have no idea what "learning" looks like when applied to coding. I can very easily determine what I have learned and how well I have learned it when it comes to things like physics and mathematics, but not for coding.

I have taken two coding classes (technically one, since the second focused on a hardware description language). That one class was on C/C++. I got an A, and it seemed like my professor thought that an A translates to "knowing" how to code in C; at least, we should be able to put it on resumes as a skill without being deceitful. Yet, I would not dare put C/C++ on any resume. As far as I can tell, I learned nothing. So, if after a semester ending in an A I am no closer to "knowing" C, what exactly does "learning" look like in the first place? This bothered me a lot, since if I end a semester with an A in, say, a math class, I can confidently demonstrate that I "learned" most of the course material at a later date.

I guess I'm just asking for a more detailed explanation of how one "learns" coding. All the answers I've encountered thus far have been vague and unsatisfying. I hope to take a computational physics class in Python next semester, which will hopefully leave a more long-lasting impression on my brain than that C class.
 
Technology news on Phys.org
dpatnd said:
That one class was on C/C++. I got an A, and it seemed like my professor thought that an A translates to "knowing" how to code in C; at least, we should be able to put it on resumes as a skill without being deceitful. Yet, I would not dare put C/C++ on any resume. As far as I can tell, I learned nothing. So, if after a semester ending in an A I am no closer to "knowing" C, what exactly does "learning" look like in the first place? This bothered me a lot, since if I end a semester with an A in, say, a math class, I can confidently demonstrate that I "learned" most of the course material at a later date.
Did you write programs in your C/C++ class? I've taught both C and C++ many times, and have always had my students write and submit programs. To my way of thinking a good test of whether you've learned a language is to be able to write programs using that language.

Some of the basic ideas of C and procedural C++ (i.e., non-object-oriented C++ with little discussion of classes) include the basic types, control structures for making choices (if ... else, switch ... case), control structures for looping (for loop, while and do ... while loops), arrays, functions, input and output.

Most of these ideas are also present in python, so if you remember anything at all from the class you received an A in, you should be able to make good progress. For myself, when I'm trying to learn a language, I write short programs that focus on one or two concepts, and then alter it to see how well I understand it.

I have programmed in Python a little bit, mostly using the Python documentation that is provided with it. I recently purchased "Python Crash Course, 2nd Ed." by Eric Matthes. I found the first half of the book to be a useful compendium of the basic concepts as they are implemented in Python. The latter half is devoted to larger projects, some of which I'm not so interested in.

dpatnd said:
I guess I'm just asking for a more detailed explanation of how one "learns" coding.
See above.
 
  • Like
Likes sysprog
dpatnd said:
I guess I'm just asking for a more detailed explanation of how one "learns" coding.
The best way to learn coding is by coding. Find some program that you would like to code, and code it. Since you are a physics major, you could try writing a program to solve some physics problem.
 
  • Like
Likes pbuk and robphy
Here's https://www.glowscript.org/ , which is a web-based incarnation of VPython.
It supports the Matter and Interactions physics textbook by Chabay and Sherwood
https://www.glowscript.org/#/user/GlowScriptDemos/folder/matterandinteractions/
Computation is integrated into the course.
It is especially good for interactive 3-D visualizations and simulations.

https://www.glowscript.org/#/user/m...terandinteractions/program/S1-hard-sphere-gas

https://www.glowscript.org/#/user/m...der/matterandinteractions/program/03-3body-3D

I've been using VPython since 2001.
(I have a lot of old code that doesn't run in the new versions. I have to revise them.)
 
  • Like
Likes dpatnd
PeterDonis said:
The best way to learn coding is by coding. Find some program that you would like to code, and code it. Since you are a physics major, you could try writing a program to solve some physics problem.
Just an idea on how to know if you have learned the, (or a) language.

There was a recent post in the Homework section about a cannon firing horizontally while placed on a slope of 42°. Where in, X, Y coordinates from the cannon, does the cannon ball land? (Assume the cannon ball lands further down th slope.)

Then modify the program to take user input for slope angle; then also for firing angle.
Then modify the program to write output to a disk file.
Then modify the program to take input from a disk file. (Created with a simple text editor, not a word processor.)

(Does the pgm gracefully handle non-numeric input? It better, because in the real world it happens. What happens if the angle is entered as forty two?)

When you get the above to work, you can confidently state that you are 'familiar' with, or 'have used' the language and have written some small programs in it. (But not an 'expert' yet.)

If you are interested, you could perhaps extend the program to find the firing angle of multiple cannons, in multiple positions, to lay down a barrage with a specified spacing of landing points.

Have Fun!
Tom

p.s. You may have noticed that one of the hard parts of programming is making sure it does something 'reasonable' when the programmers assumptions are not met.
 
  • Like
Likes dpatnd and PeterDonis
Being able to write some simple games is one way to exercise your skills. Tictactoe, Guess a Number, or Gunner (previous post with cannon elevation to hit target)

Whenever I tackle a new language, I try to do these tasks in it:
- read files, search for text write results to a new file (a poorman's grep command)
- read user input, validate it and display it (eg temperature converter fahrenheit to celsius and back)
- read directories and display the tree of files with size, date and permission attributes shown
- run external commands ie concatenate strings together to create a command and execute it
- access and process html/xml or json data
...

These tasks are useful when trying to develop custom tools for some work project you may have.
 
  • Like
Likes dpatnd
Mark44 said:
Did you write programs in your C/C++ class? I've taught both C and C++ many times, and have always had my students write and submit programs. To my way of thinking a good test of whether you've learned a language is to be able to write programs using that language.
We did have weekly coding assignments. The most complicated program I wrote in C was a "bookstore" that read from a file containing an inventory of books, their quantity, prices, etc. The user had to be able to navigate a menu allowing them to view the info of any book searched by title. They then had to be able to purchase their chosen books in the desired quantity, after which the program would write an invoice file and update the inventory file with the remaining quantities.
It took me quite a while, and I certainly wouldn't know where to begin if I wanted to replicate it.
 
Tom.G said:
Just an idea on how to know if you have learned the, (or a) language.

There was a recent post in the Homework section about a cannon firing horizontally while placed on a slope of 42°. Where in, X, Y coordinates from the cannon, does the cannon ball land? (Assume the cannon ball lands further down th slope.)

Then modify the program to take user input for slope angle; then also for firing angle.
Then modify the program to write output to a disk file.
Then modify the program to take input from a disk file. (Created with a simple text editor, not a word processor.)

(Does the pgm gracefully handle non-numeric input? It better, because in the real world it happens. What happens if the angle is entered as forty two?)

When you get the above to work, you can confidently state that you are 'familiar' with, or 'have used' the language and have written some small programs in it. (But not an 'expert' yet.)

If you are interested, you could perhaps extend the program to find the firing angle of multiple cannons, in multiple positions, to lay down a barrage with a specified spacing of landing points.

Have Fun!
Tom

p.s. You may have noticed that one of the hard parts of programming is making sure it does something 'reasonable' when the programmers assumptions are not met.
I see. This is more the sort of detail I was looking for in an answer, thank you.
It seems to me that -- at least with the type of problem you gave as an example -- the purpose of writing a program is not to extract a result that would be difficult to get by hand, but rather to extract multiple results quickly for varying initial conditions.
 
dpatnd said:
It seems to me that -- at least with the type of problem you gave as an example -- the purpose of writing a program is not to extract a result that would be difficult to get by hand, but rather to extract multiple results quickly for varying initial conditions.
For the example given, yes - definitely.

For a different example the purpose for the program might be to take a crazy number of variables and possibilities into consideration and come up with a 'reasonable' conclusion.

What comes to mind would be many trains traveling both directions on a few one-way tracks with turn-outs scattered at various distances.

With only a few trains, your brain, pencil, and paper would have a chance of finding a usable schedule and train speed. With tens or hundreds of trains to schedule your short term memory is quickly overloaded for details, and even for where to find the details that you have already written.

So yeah, use a computer for multiple answers to the same problem, or to handle the bookkeeping for large problems. And once you are comfortable with a language, sometimes you will be surprised at how small a problem can be where it is done quicker by writing a program for it!

Cheers,
Tom
 
Last edited:
Back
Top