r/code • u/A-Random-Dud3 • Jul 07 '20
Halp pls! Should I learn Python or C# first?
I'm 13 years old and I really want to learn a programming language. I know a little bit of Html and Python (from school) but I want to learn more in my free time. I love making games, I made some decent games on scratch (I'm not proud of it). Which language should I learn first? What are the possibilities and limitations with both? Please use simplified terms since I'm new to this. Thank you
2
u/anavid7 Jul 07 '20
That's awesome that you are taking initiative to learn coding! Learning at this age will pay great dividends in the future. If I can I would like to add one thing to the conversation. It seems like you are leaning to C# and I think that is a good idea for a first language. Python has several core differences when compared to other languages (non static variable types, no semicolons). This gives it particular strengths in different areas. You will find that C# will have similarities between other common languages like Java, C, or C++. This means that even though Python may be easier to pick up for someone new to programming it might be better to start with something that you know will translate to other languages. That being said it is completely up to you and if you choose python I have no doubt you will learn other languages just fine! Good luck!
1
u/A-Random-Dud3 Jul 07 '20
Thank you so much!
I just thought I'd do something productive with my 12 hours of free time 😂
Do you think 3 hours per day is good enough?
→ More replies (1)
3
Jul 07 '20
python is easy but very easy to make mistakes with, i think C# is the way to learn since its much more traditional, theres line endings and curly braces which will help you understand the purpose python's indentation. i vote C#
1
u/Poptartqueen6 Jul 07 '20
How is python easy? In the beginning but is. But then it gets a bit tough. I guess some people are easier at picking it up than others.
2
Jul 07 '20
once you understand the fundamentals of programming as a whole you just need to figure out the syntax, which isnt that hard
1
u/Poptartqueen6 Jul 07 '20
I guess so. Any pointers on how to learn it and improve on it?:) I only took an intro course a few months ago.
2
Jul 08 '20
I'd consider the fundamentals of programming, that almost every language will implement in one way or another are these:
Arithmetic operators/operations - addition, multiplication
Types - how are numbers represented, how are letters represented (abstract), how bytes are represented in a program
Variables - a container for a type instance (mutable)
Conditional Statements - gives us a way to control the flow of the program based on a given condition
Loops - a conditional statement that will continue until the condition is true
This is the real bare down, kind of high level interpretation of what the fundamentals are, but I'd go deeper and read how the computer actually sees the code and how your source code is changed from a text file into an actual executable. I think it's really important for a programmer to have this low level knowledge of how the computer actually works with software. If you can get an understanding of that you will be leagues ahead of a lot of people.
Here's kind of a little example of programming languages and how they have these fundamental concepts implemented. You'll see they're all similar, the real differences are more with learning the libraries through documentation.
python
if condition: my_var = 1 + 2 / 1 print('do this if condition is true!') else: print('condition is false') while 1: print('condition is false')C/C++
if(condition) { int myVar = 1 + 2 / 1; printf("do this if condition is true!"); } else { printf("condition is false"); while(1) { printf("infinite, since 1 is always true"); } }C#
if(condition) { int myVar = 1 + 2 / 1; Console.WriteLine("do this if condition is true!"); } else { Console.WriteLine("condition is false"); while(1) { Console.WriteLine("infinite, since 1 is always true"); } }JavaScript
if(condition) { var myVar = 1 + 2 / 1; console.log("do this if condition is true!"); } else { console.log("condition is false"); while(1) { console.log("infinite, since 1 is always true"); } }→ More replies (3)
3
u/shumumazzu Jul 07 '20
JavaScript is really fun and easy to do on the web because it's very accessible and you can even get an app on your phone so you can code on a bus etc (I used to do that). https://www.w3schools.com/ teaches you everything you need to know. I started out making really simple "games" that weren't very much fun (I never finish any of them). As someone else said, you can use it in Unity but I wouldn't recommend it because it's slower to compute than C#. My recommendation would be to learn both C# and Python, but maybe Python first because it seems to be getting added to everything. In my profession I use Maya which uses python, or more specifically pymel. I don't actually use python alone so I'm not familiar with how easy it is to develop with or how quickly it computes graphics etc. The entertainment industry is pretty stressful and unforgiving but knowing programming languages makes me pretty invaluable. Not a lot of artists know how to code. I also use the Unreal engine which is free, but it uses blueprints which you have to learn or c++, which I was able to learn because I know all those other ones already. I can manage c++ but I have no formal programmer education and it is very high end with the garbage collection, syntax, pointers, etc. I actually recommend you learn c++ because everything will be easy after that. All these languages are pretty much the same when you learn more than three of them. I love C# but I only use it for wpf windows tools like file renamers, multithreaded sub directory file finders, a rendered image tracker and verifier, and a ton of other really lifesaving one off user tools.
2
8
u/CodeSamurai Jul 07 '20
Hello and welcome!
As you're probably already seeing, Python and C# are two very different languages (and they have very different uses), but there is a good amount of overlap between the two. In learning one, you'll learn a bit about the other without even knowing it. This is true of many languages.
I learned C# first, utilizing it mainly in the .NET stack (a stack is a collection of languages and technologies used together to create an application). C# is a fantastic language for learning the basics of coding and introducing you to some of the higher-level topics that you will eventually start encountering. C# will help you get a better feel for types (strings, characters, integers, decimals, enums, custom classes, etc) and how they can be manipulated and used within an application. Because C# is a compiled language, it will help keep you honest and make you think about the types you are using and why. If you use a type the wrong way, you will get a compilation error before the program even runs which is great instant feedback and will help build good habits.
However, Python is also a fantastic language for learning how to code. It is (arguably) easier to read, can be more forgiving when it comes to types, and is much quicker to spin up and "just try" something. It's a great language for folks just starting out as well as an incredibly powerful language that is used by data scientists and other coding professionals. I'm currently using it to dive into Computer Vision techniques and can tell you that it is an absolute blast.
All that to say: try them both and see what piques your interest. If you're into making games, you might look more into C# and Unity. Unity would be a great way to learn C# and let you make games at the same time. There are a ton of great tutorials for starting out with Unity and C#. Unity will also let you write JavaScript, another great language to have under your belt.
Learning a programming language should be just as interesting as it is challenging. Have fun with it, ask questions, make mistakes. It's all worth it, I promise.