Is python the ideal programming language for beginners?

I really want to know fro you all

Hey @valentineaikins

Python can be used by beginners to learn programming.

There are also negatives things to python: whitespace formatting is not obvious for beginners, python errors tends to be unhelpful, list comprehensions is difficult, etc.

But, it depends on the audience on what would be the ideal language. I learned to code using Pascal and I don’t think another language would have been that much better for me at the time.

Do you want to learn programming or do you want to teach programming?

Hi @valentineaikins,

This is a question I have come across quite often. @dirk has made a very good case for why python is useful for beginners, but here are some other points to consider:

  • What is the beginner’s interest in programming? Is it general, or is there a specific aspect of programming or specific field in which they would be interested in being involved.
  • If they have a specific interest in an aspect of programming or a specific field, then a language used in that field or for that application area might be better suited than Python. For example, if a system administrator had specific interest in learning to program so that they could write Linux kernel modules, then perhaps C or C++ would make more sense to learn than Python.
  • If they, however, have a general interest in programming, then it should be considered that the syntax and language choice is secondary to programming principles and problem solving skills.
  • My experience in the field of software development has been that often knowing a single language is insufficient, as the technology chosen for a solution should match the requirements of that solution. For example, just because you can program in Fortran doesn’t mean you should use it for creating a website.
  • Programming and Problem Solving skills are easily transferable across languages and syntax. For example, if you know the general structure of a bubble sort algorithm, you can implement it in almost any language by just looking up the syntax for assignment, FOR loops and arrays.
  • If the beginner is planning on eventually writing enterprise-scale object oriented systems, I would recommend against Python, as its implementation of the more advanced aspects of Object Orientation is quite lacking, and thus harder to grasp the concepts using Python over another language such as C++, Java or C#.

Having said that, I love Python and think that in most scenarios, learning Python as a first language is not a bad idea.

Hope that gave you some food for thought.

Kind Regards,
Ralfe

P.S.: As a shameless punt, I have developed some courses teaching programming theory using Python. Take a look here if you are interested: https://p2pu.org/en/courses/1079/programming-theory-in-practice-1/

Hi Dirk and Ralfe,

Thank you very much for your response. They are quite insightful and
knowledgeable.

@dirk I want learn to program and teach it as well.

@Ralfe why should the syntax and language choice should be secondary to
programming principle and solving problems to the beginner.

@dirk I think the links provided are very helpful. Anything else from your
own self?

Thanks

Hi @valentineaikins,

The reason why syntax and language choice are secondary to programming principles and problem solving skills is because once you understand programming principles - such as loop structures, decision structures, algorithm design, how to approach solving problems - writing the solution in a specific language is the easy part. Even if you do not know the syntax of a particular language, if you know how to use programming concepts to solve the problem in a language-agnostic fashion, then writing the language-specific solution to the problem is just a matter of looking up the various pieces of syntax in a language reference.

To expand on an earlier example; if I have an array of books, and I want to sort them alphabetically, I know that I can use an algorithm (or technique) called a Bubble Sort algorithm. I can express this algorithm in a language-agnostic fashion as such:

Loop through all the books from the first one to the second-to-last book, and let the current book be j
    Loop through all the books from the book after j, to the very last book, and let the current book be k
        If the name of book k should come before the name of book j
            Swap books j and k

We call the above “pseudocode”, which is a “pseudo” programming language used for algorithm (or problem solving) design, which we can then implement in whatever language we want. For example, if I want to implement that in Python, I could write

books = ['Lord of the Rings', 'How to kill a mocking bird', 'Thus Spoke Zarathustra']

for j in range(0, len(books) - 1):
    for k in range(j, len(books)):
        if books[k] < books[j]:
            tmp = books[k]
            books[k] = books[j]
            books[j] = tmp

Or I could implement the same algorithm in PHP:

$books = array(‘Lord of the Rings’, ‘How to kill a mocking bird’, ‘Thus Spoke Zarathustra’);

for ($j = 0; $j < sizeof($books); $j++){
    for (%k = $j + 1; $k <= sizeof($books); $k++){
        if ($books[$k] < $books[$j]){
            $tmp = $books[$k];
            $books[$k] = $books[$j];
            $books[$j] = $tmp;
        }
    }
}

As you can see, the difficult part was in designing the solution (or algorithm), whereas actually writing it out in different languages and different syntaxes. Actually, you will notice the two language implementations are pretty similar. They both follow the same logic as defined in the pseudocode.

I hope I’ve answered your question and convinced you that programming principles are more important than specific languages.

Regards,
Ralfe

@Ralfe
Thank you very much. Your examples in different languages explain things
easier and much simpler to my understanding.

You must be a very great programming teacher. I really appreciate your time
and making things seem so simple in programming.

I hope you don’t mind been my mentor in programming. I love a lot of web
programming, database and object oriented programming.

Kindly advise, what should be my ideal programming language as a beginner?

I would also be happy to get more feedbacks from you to help me go through
this journey.

Thanks once again.

Hi @valentineaikins,

As I mentioned earlier, I think it is a good idea to think about what interests you about programming. If it is web development, then Python is a great language to learn. There are a number of web development frameworks that are built in Python that you can use. If you are an absolute beginner, I suggest taking a look at the Programming Theory in Practice 1 course (there is a link in my first response higher up). If you are already familiar with programming concepts and a bit of Python, take a look at a framework like Django (there are many tutorials and a lot of documentation available on the net).

Regards,
Ralfe

To echo some of what @ralfe said, it depends, there are no perfect language to start with. A lot of what you will learn when starting out is the general concepts of programming. Going with Python is a fine choice and you’ll be able to translate most of the concepts to other languages later.

Have a look at http://www.pygame.org/news.html - not a tutorial itself, but a great community. I really enjoyed the visual part of programming when I started out and pygame can help with that!