Short answer
NASA uses several languages, including C, C++, Python, and Fortran. Which one you see depends on the project, its age, and the team. In general, flight and embedded software leans toward C and C++, while Python shows up in data analysis, tooling, and automation. Fortran still appears in some older scientific code.
Where C and C++ appear
Much of the flight and embedded software on NASA missions has been written in C or C++. Spacecraft have tight limits on memory and timing, and both languages give programmers close control over those resources.
Some teams also follow published rules for safety-critical C code. One widely cited set is Gerard Holzmann’s Power of 10, which was developed at NASA’s Jet Propulsion Laboratory.
Whether NASA leans more on C or on C++ is a narrower question, covered in Does NASA use C or C++?
Where Python appears
Many teams use Python for processing data, writing test scripts, and building research tools. It is quick to write and easy to read, which makes it useful for tasks that change often or need results fast.
Where Fortran appears
Fortran is still used in some older scientific and engineering codes, including certain climate models. New projects often choose other languages, but existing Fortran code keeps running and needs maintenance.
What this means for learners
You do not need to pick one language to work in space science. C++ teaches low-level control and object-oriented design, while Python is quicker for analysis. Many developers learn both.
A small example shows the difference in style. Here is the same job, adding up three values, in C++:
#include <iostream>
#include <vector>
int main() {
std::vector<int> readings = {4, 8, 15};
int total = 0;
for (int r : readings) {
total += r;
}
std::cout << "Total: " << total << "\n";
}
And in Python:
readings = [4, 8, 15]
total = sum(readings)
print("Total:", total)
Both print Total: 27. The C++ version is longer because it spells out the loop and the types. The Python version uses a built-in function. If you are weighing the two for your own learning, see Is it better to learn C or Python?