When comparing Python vs C#, the Slant community recommends Python for most people. In the question“What is the best programming language to learn first?”Python is ranked 1st while C# is ranked 15th. The most important reason people chose Python is:

Python's popularity and beginner friendliness has led to a wealth of tutorials and example code on the internet. This means that when beginners have questions, they're very likely to be able to find an answer on their own just by searching. This is an advantage over some languages that are not as popular or covered as in-depth by its users.

Pros

Pro

Lots of tutorials

Python's popularity and beginner friendliness has led to a wealth of tutorials and example code on the internet. This means that when beginners have questions, they're very likely to be able to find an answer on their own just by searching. This is an advantage over some languages that are not as popular or covered as in-depth by its users.

Pro

Easy to get started

On top of the wealth of tutorials and documentation, and the fact that it ships with a sizeable standard library, Python also ships with both an IDE (Integrated Development Environment: A graphical environment for editing running and debugging your code); as well as a text-based live interpreter. Both help users to get started trying out code immediately, and give users immediate feedback that aids learning.

Pro

Clear syntax

Python's syntax is very clear and readable, making it excellent for beginners. The lack of extra characters like semicolons and curly braces reduces distractions, letting beginners focus on the meaning of the code. Significant whitespace also means that all code is properly and consistently indented.

The language also uses natural english words such as 'and' and 'or', meaning that beginners need to learn fewer obscure symbols. On top of this, Python's dynamic type system means that code isn't cluttered with type information, which would further distract beginners from what the code is doing.

Pro

Active and helpful community

Python has an active and helpful community, such as the comp.lang.python Google Groups, StackOverflow, reddit, etc.

Pro

Comes with extensive libraries

Python ships with a large standard library, including modules for everything from writing graphical applications, running servers, and doing unit testing. This means that beginners won't need to spend time searching for tools and libraries just to get started on their projects.

Pro

Good documentation

The Python community has put a lot of work into creating excellent documentation filled with plain english describing functionality. Contrast this with other languages, such as Java, where documentation often contains a dry enumeration of the API.

As a random example, consider GUI toolkit documentation - the tkinter documentation reads almost like a blog article, answering questions such as 'How do I...', whereas Java's Swing documentation contains dry descriptions that effectively reiterate the implementation code. On top of this, most functions contain 'Doc Strings', which mean that documentation is often immediately available, without even the need to search the internet.

Pro

Cross-platform

Installs and works on every major operating systems if not already installed by default (Linux, macOS).

Pro

Can be used in many domains

Python can be used across virtually all domains: scientific, network, games, graphics, animation, web development, machine learning, and data science.

Pro

Has many libraries for scientific computing, data mining and machine learning

Python is commonly used in data science and has many libraries for scientific computing, such as numpy, pandas, matplotlib, etc.

Pro

Advanced community projects

There are outstanding projects being actively developed in Python. Projects such as the following to name a random four:

iPython: a rich architecture for interactive computing with shells, a notebook and which is embeddable as well as wrapping and able to wrap libraries written in other languages.

Mercurial: a free, distributed source control management tool. It efficiently handles projects of any size and offers an easy and intuitive interface.

PyPy: a fast, compliant alternative implementation of the Python language (2.7.3 and 3.2.3) with several advantages and distinct features including a Just-in-Time compiler for speed, reduced memory use, sandboxing, micro-threads for massive concurrency, ...

When you move on from being a learner you can still stay with Python for those advanced tasks.

Pro

Very similar to pseudo-code

When learning Computer Science concepts such as algorithms and data structures, many texts use pseudo-code. Having a language such as Python whose syntax is very similar to pseudo-code is an obvious advantage that makes learning easier.

Pro

Supports various programming paradigms

Python supports three 'styles' of programming:

Procedural programming.

Object orientated programming.

Functional programming.

All three styles can be seamlessly interchanged and can be learnt in harmony in Python rather than being forced into one point of view, which is helpful for easing confusion over the debate amongst programmers over which programming paradigm is best, as developers will get the chance to try all of them.

Pro

One right way to do things

One of the Guiding Principles of Python is that there should be only one obvious way to do things. This is helpful for beginners because it means that there is likely a best answer for questions about how things should be done.

Pro

Good introduction to data structures

Python's built-in support and syntax for common collections such as lists, dictionaries, and sets, as well as supporting features like list comprehensions, foreach loops, map, filter, and others, makes their use much easier to get into for beginners. Python's support for Object Orient Programming, but with dynamic typing, also makes the topic of Data Structures much more accessible, as it takes the focus off of more tedious aspects, such as type casting and explicitly defined interfaces.

Python's convention of only hiding methods through prefacing them with underscores further takes the focus off of details such as Access Modifiers common in languages such as Java and C++, allowing beginners to focus on the core concepts, without much worry for language specific implementation details.

Pro

Easy to find jobs

Python's popularity also means that it's commonly in use in production at many companies - it's even one of the primary languages in use at Google. Furthermore, as a concise scripting language, it's very commonly used for smaller tasks, as an alternative to shell scripts.

Python was also designed to make it easy to interface with other languages such as C, and so it is often used as 'glue code' between components written in other languages.

Pro

Import Turtle

Do something visually interesting in minutes by using the turtle standard library package.

Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzig and Seymour Papert in 1966.

Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an import turtle, give it the command turtle.forward(15), and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.right(25), and it rotates in-place 25 degrees clockwise.

Can be statically compiled (instead of interpreted) with Cython. (Do not mix up with cPython)

With python, you're sure your code can run (almost) everywhere, from 2€ computers to the most expensives.

So, for instance, with Jython you can access the Java libraries with Python language.

Pro

Best chances of earning most money

According to Quartz, Python programming skills on average earn $100,000 per year. Closely followed by Java, C++, JavaScript, C, and R with $90,000 per year and above.

Pro

Static typing via mypy

Python's syntax supports optional type annotations for use with a third-party static type checker, which can catch a certain class of bugs at compile time. This also makes it easier for beginners to gradually transition to statically typed languages instead of wrestling with the compiler from the start.

Pro

.NET is a great toolbox

C# runs on top of the .NET framework, which provides many libraries containing classes used for common tasks such as connecting to the Internet, displaying a window or editing files. Unlike many other languages, you don't have to pick between a handful of libraries for every small task you want to do.

Pro

Awesome IDE for Windows

On Windows, Visual Studio is the recommended C# IDE. It provides a very flexible GUI that you can rearrange the way you want and many useful features such as refactorings (rename a variable, extract some code into a method, ...) and code formatting (you can pick exactly how you want the code to be formatted).

Visual Studio also highlights your errors when you compile, making your debug sessions more efficient since you don't have to run the code to see the mistakes. There's also a powerful debugger that allows you to execute the code step-by-step and even change what part of the code will be executed next. In addition to giving you all the line-by-line information you'll need in a hassle-free manner, Visual Studio has stuff you can click on in the errors window that will take you to the documentation for that error, saving you several minutes of web searching.

In addition to all of this, Visual Studio has an intuitive, intelligent, and helpful graphical user interface designer that generates code for you (the best of WYSIWYG, in my opinion), which is helpful for new programmers. Being able to create a fantastic-looking UI with one's mouse and then optionally tweak with code helps make programming fun for beginner developers.

Visual Studio also has the best code completion --Intellisense is every bit as intelligent as the name says it is. It, as well as VS's parameter hinting, is context-, type-, user-, and position-sensitive, and displays relevant completions in a perfectly convenient yet understandable order. This feature allows a new programmer to answer the questions "What does this do?" and "How do I use it?" right then and there rather than having to switch to a browser to read through extensive documentation. This allows the programmer to satisfy their curiosity before it is snuffed out by several minutes of struggling through exhaustive documentation.

And for the more adventurous and text-ready developer, Microsoft does the best job of ensuring that everything, from interfaces and wildcard types down to Console.WriteLine("") and the + operator, is well-documented and easy to understand, with relevant and well-explained usage examples that manage to be bite-size yet complete, simple yet truly helpful. The reference site is easy to navigate, well-organized, clean and uncluttered, up-to-date, and fresh and enjoyable to look at, and every page is well-written with consideration for readers who are not C# experts yet want to read about changing the console background color.

The best part? It's free! Visual C# Express contains all of the features described above, at zero cost. If you are a student, you can probably get Visual Studio Professional from your university, which also includes tools for unit testing and supports plugins.

Pro

Incredibly Well-Engineered Language

Where other languages invoke the feeling of being a product of organic growth over time, C# just feels like an incredibly well-designed language where everything has its purpose and almost nothing is non-essential.

Pro

Supports some functional features

C# is primarily object-oriented, but it also supports some features typically found in functional languages such as lambdas, delegates and anonymous classes. Methods can be treated like any other object, and the Linq query system operates on monads with lazy evaluation (though it hides this with a lot of syntactic sugar).

You don't need to use these features to code in C#, though, so you can start with OOP and then learn about them.

Pro

Great introduction to object-oriented programming

Object-oriented programming is the most widely-used paradigm. C# offers support for common OOP features such as classes, methods and fields, plus some features not found in competing languages like properties, events and static classes.

C# code is much more readable thanks to the syntactic sugar it offers. You can truly concentrate on your code, not on the way it's implemented.

Pro

Best language for Windows programs

C# is clearly the best choice for Windows programs. The .NET framework contains everything you need to build great-looking apps, without having to learn the confusing Win32 API or download a ton of external libraries. C# can also be used to build Windows 8's "modern" apps.

Very high demand in the industry.

Pro

Supported on many platforms

If you want to create a cross-platform application, you can share most of the code and write one GUI for each platform.

Pro

Can mix high and low level programming

You can code at the high level without worrying about pointers and memory management, but if you so choose you can switch to lower level programming with direct memory management and pointer manipulation (though you need to compile to specifically allow this).

Pro

With ASP CORE a good language to learn

With CORE you are no longer just limited to Windows, so a language worth learning.

Pro

Great language for Unity game engine

Unity provides a selection of programming languages depending on preference or knowledge - C#, JS, Boo and UnityScript. C# is arguably the most powerful with better syntax and stronger language structure. It allows using script files without attaching them to any game object (classes, methods inside unattached scripts that can be used at any time). There are more tutorials and information for C# than UnityScript and Visual Studio can be used to code for unity in C#. Additionally, learning C# allows using it outside of Unity as well unlike UnityScript.

Pro

.NET truly universal

With .NET core it is a truly universal programming language which support desktop apps (Windows), Mobile apps (Xamarin), Web Apps (ASP.Core MVC). Also is perfectly fit to serverless programming for micro services. Soon it will be also support Web assembly (Blazor).

Ad

Cons

Con

Not good for mobile development

You can use frameworks like Kivy, but if your ultimate goal is to write mobile apps Python may not be the best first choice.

Con

Inelegant and messy language design

The first impression given by well-chosen Python sample code is quite attractive. However, very soon a lack of unifying philosophy / theory behind the language starts to show more and more. This includes issues with OOP such as lack of consistency in the use of object methods vs. functions (e.g., is it x.sort() or sorted(x), or both for lists?), made worse by too many functions in global name space. Method names via mangling and the init(self) look and feel like features just bolted on an existing simpler language.

Con

Language fragmentation

A large subset of the Python community still uses / relies upon Python 2, which is considered a legacy implementation by the Python authors. Some libraries still have varying degrees of support depending on which version of Python you use. There are syntactical differences between the versions.

Con

The process of shipping/distributing software is reatively complicated

Once you have you program the process of having a way to send it to others to use is fragile and fragmented. Python is still looking for the right solution for this with still differences in opinion. These differences are a huge counter to Python's mantra of "There should be one-- and preferably only one --obvious way to do it."

Con

Abstraction to the point of hinderance

Python is abstracted far enough that if it's your first language, it will be harder to pick up lower level languages later versus going the other direction.

Con

Hard to debug other people's code

As the structure of Python code is based on conventions many developers are not following them and so it is difficult to follow/extract the design of not trivial application from the code.

Con

Might not be very future-proof

Lots of features that will probably be crucial as time goes (good support for parallelism for example) are missing or are not that well-supported in Python.

Con

Does not teach you about data types

Since Python is a dynamically typed language, you don't have to learn about data types if you start using Python as your first language. Data types being one of the most important concepts in programming. This also will cause trouble in the long run when you will have to (inevitably) learn and work with a statically typed language because you will be forced to learn the type system from scratch.

Con

Multi-threading can introduce unwanted complexity

Although the principals of multi-threading in Python are good, the simplicity can be deceptive and multi-threaded applications are not always easy to create when multiple additional factors are accounted for. Multi-thread processes have to be explicitly created manually.

Con

Limited support for functional programming

While Python imports some very useful and elegant bits and pieces from FP (such as list comprehensions, higher-order functions such as map and filter), the language's support for FP falls short of the expectations raised by included features. For example, no tail call optimisation or proper lambdas. Referential transparency can be destroyed in unexpected ways even when it seems to be guaranteed. Function composition is not built into the core language. Etc.

Con

Significant whitespace

While proper formatting is essential for any programmer, beginners often have trouble understanding the need and lack the discipline to do it. Add to that all those editors that randomly convert N spaces (usually 8) to tabs and you get an instant disaster.

Con

Unflexible userbase

You will be expected to rigidly stick to the coding practices and to do everything by-the-numbers.

Con

Assignment

Heavily relies on assignment, with no distinction between defining the variable and assigning the value. This makes it necessary to introduce rather complex environmental model of computation.

Con

Dependecy on IDE

Most people learn and depend on VisualStudio to write C#. The result is people learn how to use an IDE and not the concepts or fundamentals of good programming. This isn't necessarily a knock on the language itself, but it is frustratingly difficult to do things in C# when not using VS.

Con

Too easy to write multithreading apps that are buggy

Other languages with multithreading push users towards safe constructs, like passing messages and immutable or synchronized containers. But in C# the data structures aren't synchronized by default, and it's too easy to just set a field and observe the result from another thread (until you compile with Release, and now you have a heisenbug).

Con

Complex syntax

Too many syntactic constructs to learn before it becomes usable.

Con

Often-used products in most C# development environments get expensive

The majority of the C# development community uses Microsoft products which are not all free and open-source. As you get into the enterprise level of some of these products and subscriptions, the expense is multiple factors of 10 greater.

While you can use a fully open-source and free C# environment, the community around that is much smaller. While this can be said for other languages as well, the majority of C# falls into the for-pay Microsoft realm.

Con

Lacks standard-library support for immutable data structures

Alternative Products

Each month, over 2.8 million people use Slant to find the best products and share their knowledge. Pick the tags you’re passionate about to get a personalized feed and begin contributing your knowledge.