So i already did a Python course like 1/2 and I'm repeating it As a second programming language , i read on the web that I have to learn C to kind of have a good grasp of what's going on on the lower level
Videos
There's no right or wrong answer, really. But I think you'll benefit more from learning Python. Given the similarities between C# and C++, you'll learn a different way of thinking from Python. The more ways you learn to think about a problem, the better it makes you as a programmer, regardless of the language.
The benefit of going from a more static language to a dynamic language is to change your programming paradigm -- it's not a matter of becoming "lazy" so much as realizing new ways of accomplishing things, which will make you better in any language.
Hello, I want to start learning python because I recently started a machine learning class at my school, and I'm wondering how long would it take me to learn all of python?
I knew C before I knew Python. No offence intended, but I don't think that your C knowledge is that big a deal. Unless you read very, very slowly, just set out to learn Python. It won't take that long to skim through the material you're familiar with, and it's not as if a Python tutorial aimed at C programmers will make you a better Python programmer - it might teach you things in a different order, is all, and raise some specific things that you would do in C but that you should not do in Python.
Strings in Python actually are somewhat different from strings in C, and they're used differently. I strongly recommend learning them "from scratch", rather than thinking about them in terms of their differences from C strings. For one thing, in Python 2 it's best not to use Python's "string" class to represent strings: there's a separate unicode string class and for practical Python apps (pretty much anything involving user data), you need that. (Python 3 fixes this, making the str class a unicode string). You need to establish a good working practice for unicode/byte data and decode/encode.
A common mistake when learning a second programming language, is to think "I know how to program, I just need to translate what I do in C into Python". No, you don't. While it's true that an algorithm can be basically the same in different languages, the natural way to do a particular thing can be completely different in different languages. You will write better Python code if you learn to use Python idiomatically, than if you try to write Python like a C programmer. Many of the "tricks" you know that make sense in C will be either pointless or counter-productive in Python. Conversely many things that you should do happily in a typical Python program, like allocating and freeing a lot of memory, are things that in C you've probably learned to think twice about. Partly because the typical C program has different restrictions from the typical Python program, and partly because you just have to write more code and think harder to get that kind of thing right in C than you do in Python.
If you're learning the language because you urgently need to program a system/platform which has Python but doesn't have C, then writing Python programs that work like C programs is a reasonable interim measure. But that probably doesn't apply to you, and even if it did it's not the ultimate goal.
One thing you might be interested to look at because of your C experience, is the Python/C API. Python is great for many things, but it doesn't result in the fastest possible computational core of scientific apps [neither does C, probably, but let's not go into FORTRAN for now ;-)]. So if you're aiming to continue with scientific programming through your move in Python, and your programs are typically memory-bus- and CPU-bound doing immense amounts of number-crunching (billions of ops), then you might like to know how to escape into C if you ever need to. Consider it a last resort, though.
You do need to understand Python reasonably well before the Python/C API makes much sense, though.
Oh yes, and if you want to understand OOP in general, remember later on to take a look at something like Java, Objective-C, C++, or D. Python isn't just an OO language, it's a dynamic OO language. You might not realise it from comparing just C with Python, but dynamic vs static types is a completely independent issue from the OOP-ness of Python. Python objects are like hashtables that allow you to attach new fields willy-nilly, but objects in many other OO languages store data in ways which are much more like a C struct.
I learned everything I know about Python from the official documentation: http://docs.python.org/
And it's free.
The reference implementation of Python, CPython was indeed written in C, but saying that Python is written in C is an oversimplification:
- There are implementations written in other languages, like Jython (written in Java), IronPython (written in C#), PyPy (writen in Python), CLPython (written in Common Lisp), Psyco (also written in C), Stackless Python (written in C and Python) and Unladen Swallow (written in C++)
- Although the CPython interpreter is written in C, it is possible to write modules for it in C++ or Cython (not to be confused with CPython), as well as C
- What language a language's interpreter is written in is only important if you want to write modules / extensions to the interpreter itself, it has nothing to do with the language
Several languages (like Java, PHP, C# and others) are referred to as belonging to the C family, that has nothing to do with what language tools (compilers, interpreters) for said languages are written in but it means that they have very similar syntax to C. Python's syntax is very different from C, not only does it not belong to the C family, its actually quite far from it.
Apart from the CPython interpreter, the only other relation that Python has to C is that they are both multi-purpose, multi-paradigm programming languages.
Whichever one you choose to learn first will greatly help you learn the other one, and that's true for every programming language, as the one you learn first will introduce you to programming concepts and ways of thinking that are common in every language.
Python is generally regarded as a higher level language, whereas C as a lower level language, meaning that Python is closer to what we humans consider friendly and C closer to what the machine considers friendly, so Python is a little bit easier for beginners to start with.
Python syntax is nothing like that of C. So having prior knowledge of C really has nothing to do with how well you will learn python. Just because under the hood there is C code doesn't mean that you will learn python any quicker because you know C. As a python programmer you are dealing with the syntax of python not C.
C will take a week to learn, and a lifetime to master.
Reading a K&R book and not writing code is like reading a book on weapons and never actually shooting. Yes, you've read in a book, that it works this way, but you have never encountered the typical problems that arise while doing this. Without practice such "knowlegde" is worth very little.
Plan to spend 2-3 years slowly writing small programs for solving different tasks in C. This will count as real experince. C provides delayed gratification for your effort.
I'm thinking of learning C and/or C++, how long would it take to learn the complete basics, enough to make a short game?