Can You Learn Python Without Knowing C?

Can You Learn Python Without Knowing C?

When I started learning programming as a software engineering student, my first programming language that I started to play around at home was Python. Later at the university I found out that all the introductory programming courses were based on C. Which one is the better way to get into programming? Do you need to know C to start learning python?

One of the reasons for python’s success is that it’s very beginner-friendly. It is absolutely possible to pick it up without any prior experience, you don’t need to know C or any other programming language to learn python.

There are plenty of successful python developers out there who never wrote a single line of C code in their life, while in some specific areas you won’t get very far if python is the only language you know. So, should you start with C or Python? It depends on what your personal goals are. Are you looking to get into DevOps? Data science? You want to be a game developer or a systems programmer? Let’s look into the pros and cons of python and C in these and other areas.

Why Python is a Great Choice as a First Programming Language

  • Python is easy to set up: download, install, start coding
  • The syntax is very simple, python is much easier to read and write than other languages. Learning is enjoyable and fun, it is easy to stay motivated as you will be able to write useful little snippets very early on.
  • The official documentation is great and there’s a huge amount of free learning material available online
  • It is an interpreted language which means you can instantly run the code you write, you don’t have to wait for it to compile and build. Neither you have to worry about setting up a toolchain for that.
  • It has very powerful high-level data structures built-in, and a great standard library so you can concentrate on the logic and algorithms instead of implementation details. You can concentrate on the more interesting and useful stuff.
  • Python uses indentation for structuring code, which will force you to develop good code formatting habits.
  • It is dynamically typed, which means you won’t have to worry about whether you want to store an integer or a string.
  • Python has a huge, robust, mature ecosystem. You’ll find great third party packages for everything you need.
  • Python is memory-safe, it handles the painful task of allocating and freeing memory for you. Proper memory handling is hard, any mistake can lead to bugs that are notoriously hard to track down, it can be extremely frustrating for beginners and of course, it takes away a lot of your precious learning time.

Is C a Prerequisite for Python?

No, C is not a prerequisite to learn python. The two languages aren’t too closely related, their syntax is quite different. At first glance, Java, C++, C# or even PHP and JavaScript will look more familiar to a C programmer than python. Python is more similar to Ruby and CoffeeScript both in syntax and philosophy.

Does Learning C First Make it Easier to Learn Python?

Yes, it will. Any previous programming experience will help, a second language is always easier to pick up, as you are already familiar with the basic concepts. But my recommendation would be to do it the other way around: learn Python first, then move on to C.

Why C is Harder to Learn than Python

Let’s look at a simple example.

for number in ["one", "two", "three"]:

This little snippet prints the words one, two and three on your console. Now let’s look at the same example in C.

#include <stdio.h>
int main(void) {
	int i = 0;
	const char *numbers[3] = {"one", "two", "three"};
	for (i=0; i<3; i++) {
		printf("%s\n", numbers[i]);
	return 0;

Got my point? If you are a beginner, just starting to learn how to code, you’ll easily get frustrated if you have to juggle concepts like memory management, pointer arithmetics and typechecking. Python is really is to pick up compared to C, because it hides all those painful implementation details from you. Of course it comes with a price, but I’ll get back to it later.

Popularity Over Time - The future of Python and C

When you’re deciding whether it is a good idea to adopt a new technology it’s always worth asking the question if it is rising or falling in popularity? Is there a growing demand for that skill or is it in decline?

Here’s a chart from google trends comparing the popularity of Python and C over the last 15 years. The red marks Python, the blue is C.

Popularity of Python and C programming languages compared

The data speaks for itself, python has been gaining serious traction in the last few years. Of course, C is not going away anytime soon, but it is getting more and more niche now, the trend is moving towards higher-level languages.

Python Career Opportunities - Areas Where You Can Use It

Learning Python can open up a huge amount of great career opportunities for you. In the latest developer survey conducted by StackOverflow Python ranked 4th on the list of most used programming languages and tools, seriously outranking C.

Programming languages ranked by number of users

Some of the specific areas Python developers are in demand:

  • With the rise of great frameworks like Flask and Django, python is getting more and more popular amongst web developers.
  • Python has always been great for scientific and statistical computations. If you are looking to build an academic career, knowing at least some python can come very handy.
  • With the growing demand in machine learning, it is an area where python is the number one programming language today.
  • Python has a reputation of being great for task automation, that’s it is the goto language for the majority of system administrators, SREs and DevOps engineers.

This survey conducted by JetBrains shows the different areas where developers, scientists and engineers use python during their daily work:

Areas where Python is being used

Areas Where C is a Better Choice

Of course, C also has its merits. As it is a compiled language - which means it has to be translated to a binary executable before running - unlike python which is interpreted on-the-fly before every run. It means C programs can run much faster than python. It can also be optimized to consume less resources, which makes it great for embedded systems, resource-intensive calculations, realtime systems, and time-critical applications.

So if you want to get into things like hardware programming, developing drivers or operating systems, cryptographic algorithms, 3D rendering engines and areas like that, knowing only Python - while it can be a good foundation - just won’t be enough.

Concepts that You’re Not Going to Learn with Python

Having said all of the above, there are some concepts that you are NOT going to learn with python. As it is a pretty high-level programming language, it hides a lot of the low-level implementation details from you. This is great if you are a beginner, as it makes your first steps so much easier - but sometimes it comes handy if you know what’s going on under the hood.

As python is a dynamically typed language you don’t really have to deal too much with types and type conversions. However, this allows you to develop sloppy habits and transitioning later to a statically typed language like Java or TypeScript can be painful. You won’t learn about the subtle but important difference between variable declaration, definition, and initialization.

Python does support object-oriented programming - which is the most popular programming paradigm today - but does not really enforce. Again, python gives you a lot of freedom here, which can lead to getting sloppy and developing poor coding habits.

While languages like Java and C++ you have sophisticated methods to handle object member field and function visibility, python does not really have that - but the same can be said about C as well, as it does not support the object-oriented paradigm at all. Visibility is not a difficult concept, I would not worry too much about it, you can pick it up rather quickly if you need it.

Another paradigm that has been on the rise lately is functional programming. While python has some support for functional-style coding, it is far from being the best out there, the syntax can be quite clumsy sometimes.

Closing thoughts

To summarize all of this: you will not have any difficulties learning python without prior knowledge of C. On the contrary, python is a great choice for your first language, it can be an awesome introduction into the world of programming.

Python has a great learning curve and is highly in demand at the moment, so you can get quite far by learning it.

Of course, if you’re interested in learning C as well I’d highly recommend looking into it, it certainly will make you a better developer. But I’d suggest picking up C after you have some basic foundation in programming.