python

Beginner’s approach to Python programming

by Sanjay Kumar

Python is a multi-purpose, open-source, object-oriented, interpreted, high-level programming language with the simplest syntax that makes it beginner-friendly.

It was created by Guido van Rossum in the early 1990s at Stichting Mathematisch Centrum (CWI) in the Netherlands as a successor of a language called ABC.

The first version of Python code (version 0.9.0) was released at alt. sources in February 1991.

Why Python?

Today majority of developers all over the world are using Python. Not only developers even most students and scholars are learning Python as their first programming language. In today’s era almost every programmer wants to learn Python even if they are working with some other programming language. The Python language has the highest demand globally and financially. The main reason behind so much popularity of Python is its versatile collections of libraries and modules.

Also Read A Complete Tutorial on How to secure WordPress Login Page

What are the different applications of Python?

Today Python is the only programming language in the world which is having 360-degree applications almost in the very field.

Following are the wide applications of Python:

  1. Machine Learning(ML) and Artificial Intelligence(AI)
  2. Data Analysis & Data Visualization
  3. Scientific & Numeric Computation
  4. Web Development
  5. Software and Game Development
  6. Graphics User Interface(GUI) Development 
  7. Network Programming
  8. Business Applications
  9. Education
  10. Internet of Things(IoT)

What should be the beginners’ approach to learn Python?

When it comes to learning any programming language, the following are the points that have to be considered:

  • The first thing to learn is the syntax of that language. The syntax of any programming language simply means “a set of rules that has to be followed while writing the code in that language”. So, here is the answer to why most people use Python as their first programming language- Because it has the simplest syntax as compared to the other programming languages like C, C++, Java, etc.
  • Another important thing to be considered before learning Python is the platform where you easily can execute your Python code. If you want you can install Python on your local machine by downloading it from www.python.org. or you can use Google Colab it is the simplest and the easiest way to run Python code online. You can learn Python most effectively and efficiently using Google Colab there is no need to download and install any Python library and module. You can simply focus on learning the core concepts of Python programming.
  • How to use Google Colab for running Python code?
  • Write your Python code in the provided code cells run it by clicking on the run button provided with each code cell or by pressing Shift + Enter.
  • There is also a text cell provided in the Jupyter notebook, which you can use to add some explanation about the working of your Python code.

Basic data types in Python.

# Checking basic Data types in Python using type() function
print("101 is ", type(101))
print("11.33 is ", type(11.33))
print("True is ", type(True))
print("'Scholar Basta' is ", type('Schlolar Basta'))
print('"Scholar Basta" is also ', type("Schlolar Basta"))

How to print outputs on the screen?

We can print anything on the screen using the print() function in Python.

How to take inputs from the users?

We can take inputs from the users using the input() function in Python. Remember any value which is taken from the user using input() function is by default of string type. You can take inputs from the users in two ways:

By displaying a message for the users

By simply taking the input without a message for the users

How to perform simple athematic operations in Python?

# Taking inputs from the users
A = int(input("Enter Value of A: "))
B = int(input("Enter Value of B: "))

# Producing outputs
print("A + B = ", A+B) # Addition
print("A - B = ", A-B) # Subtraction 
print("A x B = ", A*B) # Multiplication
print("A / B = ", A/B) # Actual Division(can produce floating Point results)
print("A // B = ", A//B) # Floor or Integral Division(produces integral results only)
print("A % B = ", A%B) # Produces remainder
  • Now the most important thing you should learn as a beginner is Data Structures in Python also known as “collection data types” which are used to store the collection of items in a single variable.

     Some basic and very useful data structures provided in Python are:

  • Lists [ ]: It is simply used to store a list of items in a single variable.

All the items in a list are changeable.

Items of a list are indexed i.e. the first item is stored at index= 0 and the last item is stored at index= size-1

It allows duplicate values.

  • Tuples ( ): Like lists, it also udsed to store the collection of items in a single variable.

But all the items in a list are unchangeable.

But items of a tuple are indexed i.e. the first item is stored at index= 0 and the last item is stored at index= size-1

Like a list, it also allows duplicate values.

  • Sets { }: It is also used to store multiple items in a single variable.

But the items are unordered and unindexed.

It cannot store duplicate values like lists and tuples.

And it is unchangeable also like a tuple.

  • Dictionaries { ‘A’ : 1 , ‘B’ : 2, ‘C’ : 5}: This is quite different from all other collection data types in Python, A dictionary is used to store the items in key : value pairs.

The items of a dictionary are unordered but changeable.

But does not store duplicate values like lists and tuples.

  • How to define fuctions in Python: A function has three components which are:
    • Function_name
    • Parameters
    • Definition of the function
    • Value returned by the function

All the things discussed above are the basics you need to learn as a beginner in Python.

Related Posts

Leave a Comment