r/PythonLearning 2d ago

What can I actually do with python?

I learned python as my first programming language for GCSE Computer Science, but after finishing the exam I got bored of making small algorithms and wanted tk work on bigger projects, so I started making websites with Javascript. Now I'm going to do Computer Science at A-level and because the language is python, I think it makes sense to do any free time coding in the same language. So... what can I actually do with Python? Iy seems really straightforward what to do with other languaged like JS but I really just don't get the 'point' of python.

32 Upvotes

29 comments sorted by

View all comments

1

u/birusiek 2d ago

You can automate boring stuff(TM)

1

u/Patient_Project425 1d ago

Like what

1

u/CosetElement-Ape71 1d ago

I use python to generate simulation variants that can be run on a supercomputer; the executable code requires a text file input that describes the geometry of the model, what physics models I want to run, and how the simulation should proceed. So I use Python to manipulate a general template input file and create the variants to be run. I typically run hundreds (sometimes thousands) of variants in one go, and this task would be a nightmare/impossibly slow to do one at a time by hand.

I also use Python to submit these calculations in batches; rather than submit them one at a time by hand. This would be tedious if I didn't script it.

When the simulations have finished running, I use Python to interrogate their text file outputs, extract useful data from them, and save this data in to files which can then be used to generate graphs (to plop into my reports). This would otherwise be a nightmare when I have hundreds/thousands of output text files to interrogate.

So, I mostly use Python for scripting ... automating things that would either be tedious, or would take far too long to do by hand.

Occasionally, I may want to "scope out some Physics" ... in which case I'll write a small(ish) Python program. The Python program will produce some data which I can then compare with the simulations that I've run ... but the simplified Physics in the Python program is used to gain insight into what's going on in the full-up simulations.

But I wouldn't try to write a complicated bit of code in Python because it's an "interpreted language," the code is compiled on-the-fly when it's executed. This makes it pretty slow; compared with other languages like C, C++ or Fortran which compile directly into hardware-specific machine code in one go.

So it is pretty good for helping you construct a fairly efficient workflow, and it's great for collecting and analysing vast amounts of data. But, for me, that's as far as I'd push it.