Explore the Wonderful World of Programming Languages with Python! | Part 1

Software engineers are the unsung heroes of tech evolution. They're the wizards behind our mobile apps, websites, self-driving cars, and even rockets! Thanks to these coding masters, we're all now linked through the magic of social media. Their expertise in coding languages and problem-solving skills have paved the way for countless innovations that have revolutionized the way we live, work, and communicate. From developing cutting-edge algorithms to creating user-friendly interfaces, software engineers play a crucial role in shaping our digital world. Their dedication to continuous learning and adapting to new technologies ensures that we are always at the forefront of innovation.

So if you also want to learn to code and become an unsung hero of modern tech evolution then you are in the right place. Here I am going to introduce you to programming languages with the help of Python. Let's see how I will walk you through:

  • First, we will talk about the programming concept and after that, we will use that concept in Python programming language.

  • Throughout our learning path, we will be solving lots of problems.

So if you are excited then let's jump into the introduction to programming languages.

Why should you learn to code?

Before even starting let’s discuss why you should learn to code.

  • Learning to code boosts your problem-solving skills, and fosters creativity.

  • Coding can help you think analytically and lets you make logical decisions.

  • Programmers enjoy high salaries.

  • Job opportunities.

  • Programmers are the architects who design and build the technological innovations that shape our world.

Got excited! then let’s dive into it.

Why Python?

First of all, you might have a question about why to start from Python and not from any other language like C, C++, etc. So my friend there are many reasons why Python is a great choice for beginners and experienced programmers

  • Easy to learn:- Python's syntax is known for its readability because it resembles the English language. The program, written in Python is like a pseudo code written in English. This makes it easier to pick up the basics and focus on the core concepts of programming.

  • Versatile:- Python can be used for multiple different things from web development and data science to machine learning and automation. It is also used in scientific calculations as well.

  • Extensive Libraries:- Because of Python's huge community base, it boasts a vast collection of libraries and frameworks.

  • High demand and good salaries:- Python developers are always in high demand across various industries which translates to good job prospects and competitive salaries.

  • Active Community: Python has a large and supportive community of developers. This means you'll find plenty of online resources, tutorials, and forums to help you learn and troubleshoot any problems you encounter.

Whether you're a complete beginner or an experienced programmer looking to expand your skillset, Python is an excellent choice. Its readability, versatility, and extensive ecosystem make it a valuable tool for anyone interested in the world of programming.

How to learn a language?

See in a language there are two things Words and Grammar (which means how you arrange those words to form a meaningful sentence). For example:-

Let’s say you want to learn English so you will consider learning words in the language,

Such as [“Is”, “good”, “he”, “a”, “boy”] and grammar or the rules of how you will arrange those words to form meaningful sentences like

  • He is a good boy.

  • Is he a good boy?

Similarly, in a programming language, we have words (and we call them Keywords) and rules (and we call them Syntax).

  • Keywords: In programming languages, keywords, are also known as reserved words. These are special predefined words with specific meanings. These words are reserved by the language itself and cannot be used for other purposes in your code.

  • Syntax: In programming language syntax refers to the set of rules that define the structure and organization of code. As I said, it’s like the grammar of a human language, but for computers.

So to learn a particular programming language you will need to know both the keywords and the syntax of that particular language. Yes, you read it right, different programming languages can have different keywords and syntax based on those keywords.

Types of Programming

Now you know what programming language is. Then let me tell you something, computers don’t even understand what you are writing using any programming language because they only understand machine code i.e. 0s and 1s. So a program (which you have written in a programming language) needs to be translated into machine code and to translate a language we have two ways Compiler and Interpreter, we differentiate programming languages based on how they get translated into machine code and we call them Compiled language or Interpreted language.

  • Compiler: A compiler, in the world of programming, is essentially a software program that acts as a translator. It takes code written in a human-readable language (in a programming language), called source code, and converts it into a different language ( or machine code ) that the computer can easily understand and execute the code. Languages using compilers are C, C++, C#, Java, Go, etc.

  • Interpreter: An interpreter is a software program that directly executes instructions written in a programming language, line-by-line. Languages using compilers are Python, JavaScript, PHP, etc.

The key differences between them are:

  • Compilation vs. Interpretation: Compilers translate the entire source code into machine code beforehand, while interpreters execute line by line.

  • Speed: Compiled programs generally run faster because the machine code is optimized for the specific system. Interpreted programs might be slightly slower due to the on-the-fly translation.

  • Portability: Compiled code might require recompilation for different systems, while interpreted languages can often run on any platform with the interpreter installed.

Bugs in programming languages

Imagine working on a super early computer in 1947! That’s what Grace Hopper was doing at Harvard with her team. They were building this giant machine called the Mark II, but it kept messing up. After some puzzling, they discovered a tiny surprise inside: a moth! It turned out the moth was causing problems with the computer’s circuits, acting like a little speedbump for electricity. Grace called it a ‘bug,’ and the name stuck. Because of her work in computers, the term ‘bug’ became super popular, and that’s why we still call computer errors ‘bugs’ today!

As I have said earlier that computers are dumb and they cannot do anything on their own, they can’t even make any simple decision on their own. So when they don’t understand anything they throw errors and as a programmer you need to act as a detective and hunt down those errors. Don’t worry, encountering errors are normal part of programming, the more you code the better you get at fixing errors as most of our time goes into finding and fixing errors.

The errors can be of any type.

  • Syntax Errors: These errors happen when you misspell any keyword of the programming language you are working on or mess up the punctuation. You can catch these types of errors easily as your program will not even run until you fix those errors.

  • Logical Errors: These are trickier errors because your program might run perfectly but give incorrect outputs because of the mistake in your logic building. For example, let’s say your friend is coming to your home for the first time and you accidentally ask him to take a right instead of a left, your friend will take it but he will not reach your house. These types of errors take more time to find and fix.

  • Runtime Errors: These errors occur when the program is running but your computer runs out of memory. Imagine you are dividing something by zero so the program will want to run for an infinite time, hence the compiler or the interpreter will throw a runtime error.

What is debugging?

Debugging is like being a detective for computer programs! It’s the process of finding and fixing errors, or bugs, that prevent a program from working correctly.

Imagine you built a calculator app, whenever you try to add something, your app divides those numbers instead of adding so you need to find the problem and fix it, this process is known as debugging. Here’s how it works-

Spot the problem → Investigate(hunt the problem in your code) → Found? Fix it → Test it again

In the next chapter, we will talk more about Python and write our first program in Python

If you want to learn Python by reading books on the go then you can buy or prefer these books.

Python Crash Course: https://amzn.to/3TLvIlC

Python For Everyone: https://amzn.to/3vqXqfq

Conclusion

Software engineers are essential for tech advancement, creating mobile apps, websites, and more. Learning to code, especially with Python, enhances problem-solving skills and creativity. Python's readability, versatility, libraries, demand, and community support make it an ideal choice for beginners. Understanding programming involves keywords and syntax. Programming languages are categorized as compiled or interpreted, with differences in speed and portability. Debugging is crucial for fixing errors like syntax, logic, and runtime issues to ensure program functionality.

Did you find this article valuable?

Support Just Coding Blogs by becoming a sponsor. Any amount is appreciated!