News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

A Complete Walk-Through in Python for Beginners

Started by NiveRoshni, Aug 17, 2020, 01:07 PM

Previous topic - Next topic

NiveRoshni

A magical art of teaching a computer to perform a task is called computer programming. Programming is one of the most valuable skills to have in this competitive world of computers. We, as modern humans, are living with lots of gadgets such as smartphone, computers and much more digital inventions. One must agree that gadgets are nothing without programming.

Even though the programming languages started to evolve only before half a century ago, the rate of growth was very huge compared to any other man-made things. In this article, I will teach you my favorite language Python and how to learn a language.

Do this first...

Why do you want to learn to program?

Think deeply before reading further. I asked the same question to my students on the first day of a programming class. Most of the answers were the same as the following statements.

" I want a good job in a well-reputed software company so I need to learn a programming language "
" Learning a programming language will make me able to learn some advanced technologies like artificial intelligence and machine learning "

The major reason to learn a programming language is to get a job with a good salary or to learn more about some advanced technologies. If you are familiar with some tutorial websites and online courses, then you may know that they start the tutorial by writing the applications of the language.

Learning with a purpose is not the right way. This is not going to be the right approach as that is followed by everyone. If you need to learn something do it with passion. While doing something, if it fills your heart with enthusiasm then you are in the right path.

"Programming is not a subject. It is a basic ability of human brain."

If you are a complete beginner to this language, try to learn it with your whole heart. This article is not going to make you a great developer. Only thing I can swear you that you will learn programming is a language of nature.

Why Python among others?

In this world, there are more than seven hundred programming languages available. But not everything gets noticed by all. I have started to learn programming in 2015. I just started with the language C. I still have respect on the C language. But, when I started learning python in 2019 I loved the language very much. The love is still alive. I don't know the reason for that. It may be a clean syntax. It may be the high readability of code. But something attracted me to stick with that language. I promise you that you will love the language and how it responds to the problems.

Look at the quote by its Inventor Guido van Rossum.

"The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code — not in reams of trivial code that bores the reader to death."

Among all other languages, Python is worth considering due to its simplicity and readability of code. We, as humans, use many languages to convey some information to others. Programming is language to speak with computers. If you are looking for a computer language that is same as a human language then Python is the first choice.

When you are speaking with someone, you don't need to mention what type of information you are speaking about. The person who is hearing your talk can understand that without any external aid. Python works in the same way. Not like other popular languages, It works great without declaring the data type.

The following topics will be covered in this article. This will help you to know most of the basic things in programming.

💥 How to Print something in Python?

💥 Concept of using Variable name

💥 Data Types in Python

💥 Comments in Python

💥 Operators and Their functions

💥 Decision Making and Repetition

💥 Looping statements

💥 Strings in Python

💥 List in Python

💥 Tuple in Python

💥 Set in Python

💥 Dictionary in Python

💥 Functions in Python

💥 Object Oriented Programming

💥 File System in Python

How to Print something in Python?

A program should able to tell something to the user after compiling the code. The computer will give some data after getting some set of instruction from the user. The data given by the computer is called output. The instructions are written using programing language. A computer processor will process the information and gives the output in human understandable form.

Python follows a technique called interpretation to do this. There are many opensource and commercial IDEs are available. You can use some online interpreters such as repl.it. Click the following link to practice the code examples.

https://repl.it/languages/python

Imagine, computer as your friend. Look at the imaginary conversation between two friends meeting each other in a park.

Concept of using Variable Name

Look at the second line of the conversation. The first person asking a question to the second one. Now, think about your brain. Human brain contains a large collection of memories. When someone asking about your best friend, you will get your friends image in your mind. Right?.
The brain contains a image of many people. While thinking about your friend you get the correct imagination as your brain stored the memories with some name. In programming the name that addresses a data stored in memory location is called variable.
In the above conversation. The second person gives some response which must be stored in the first persons brain. In computer science, this can be done by using input keyword. The syntax for using a variable name is given below.

Rules for naming a variable

In python there are set of rules to be followed while creating a variable name.
✅ A variable name can have alphabets (A-z), Numbers(0–9) and Underscore( _ ).
❎ A variable name should not start with any number.
❎ A variable name cannot have any special characters in it.
❎ The variable name could not be a keyword in Python.

Data Types in Python

Let me ask you three questions. What is your name? What is your age? Are you interested in learning Python? After answering these questions, look at the answers. Each answer is in different type. The first is a type of text-based data. The second one is numerical data. The third one is categorical data.

So the basic classification of data types is texts, numbers and yes or no type. The reason for classifying the data is each type behaves differently. From your age, we can calculate the age after two years. But I can't do the same operation with text-based data. In programming, the text-based data is called a string.
The numerical data can be classified into two types. One is int and another one is float. An int is a whole number whereas the float type is used for numbers with decimal places. The third type is called a boolean data type which contains only two values "True" and "False".

Comments in Python

Comments are some statements which are not considered as instruction to the computer. The comments can be used to write developer information or code usage or anything apart from the actual code.
The comment will be of two types. Single line comments and multiple line comments.
Single line comments are created using # .
Multi Line comments are created using ''' Your Comment Here ''' .

Operators and Their Functions

Just storing and retrieving data is not enough in programming. Let us look at an example. You are going to a shop to get some chocolates. Now the price of chocolate is 4.99 $. You need ten chocolates in total. After collecting the chocolates you have to pay the bill. Now, how will you calculate the amount?.

Major classification of operators in python is listed below.

🔹 Arithmetic Operators
🔹 Assignment Operators
🔹 Comparison Operators
🔹 Logical Operators
🔹 Bit Wise Operators

AraceliMathis

#1
Baby showers are a fun activity for the mom and her friends. I had even asked my friend to expert-writers.net/speech-help]www.expert-writers.net/speech-help - write my speech[/url] for me. I was planning to give it in the shower but was stopped by my wife.