Getting started with Python

Simarpreet Singh
6 min readFeb 2, 2022

--

Let's get started with what Python is, and why is it so popular.

Intro to Python

Python” is one among the foremost known, in-demand, and beginners’ 1st decisions to be told from the past 4–5 years.

But, First of all, what is Python? According to its creator, Guido van Rossum, Python is a:

“high-level programming language, and its core design philosophy is all about code readability and a syntax which allows programmers to express concepts in a few lines of code.

Guido van Rossum

What Is Python ?

  1. Python is an Interpreted, high-level object-oriented dynamically-typed scripting language.

2. However, due to this, run time errors are usually encountered.

Why is Python Popular?

  • It is thanks to the very fact that it’s easier to code and is easy to understand.
  • Python is an Interpreted object-oriented artificial language and is being used to write purposeful code.
  • Compared to alternative languages like C#/Java, it takes less time to bring a Python program to market
  • Additionally, there are a large number of python analytical packages and machine learning packages.
  • A large range of books and communities with a huge base is there to support Python developers
  • Nearly every kind of application, starting from statement analytical to UI, Forecasting is implemented in Python.
  • Since there is no need to declare variable varieties. so it’s faster to implement a Python application.

But with so many enormous things, Python lacks in some places also,

  • Unlike compiler-based languages like C++, Java, C#, Python is an interpreted language, i.e., The execution of code is done line by line.
  • Since Python is interpreted language, it’s slower than C++, C#, Java.
  • Python syntactic white-space constraint makes it slightly difficult for new coders to implement for brand spanking new coders.

Python is a fashionable all-purpose artificial language that’s being employed for a large form of applications.

A language that doesn’t affect the way you think about programming, is not worth knowing.

— Alan J Perlis

Who uses Python?

Many organizations are Python users. Some of the most vocal and best-known Python-using companies include:

It is valuable and powerful whereas additionally being clear and simple to be told. This makes it appropriate for programmers of all backgrounds and is probably going why Python is one of the foremost wide used programming languages (as of 2020). The sheer quantity of stuff you will do with Python is breathless. It includes,

  • Basic Scripts for automation
  • Graphical User Interfaces
  • Games
  • Web Development
  • Data Science
  • Mathematical and Scientific Programming
  • Machine Learning
  • Artificial Intelligence
  • Embedded Systems

And that’s simply the tip of the iceberg; knowing Python is extremely very like a body politic, you gain the power to urge into heaps of domains.

The following 3 reasons build Python stand out :

  1. A powerful and utilitarian commonplace library
  2. Its simplicity and readability
  3. The enormous system of packages and tools that come back alongside it.

An important goal of Python’s developers is to keep it fun to use. This is reflected in the language’s name — a tribute to the British comedy group Monty Python — and in occasionally playful approaches to tutorials and reference materials, such as examples that refer to spam and eggs (from a famous Monty Python sketch) instead of the standard foo and bar.

“ So lots of things have been said above, now let's dirty our hands with some python basic code. “

_Getting Started with Code_

For the installation process, refer to this

aside from that, Good suggestion

As per the first program to try in every new language, let's start with making our first program: The Hello World Program.

print("Hello World")

Yeah. Just this.

Python is literally one of the easiest and beautiful languages, Making it the beginner’s first choice.

Let's move to variables.

Python is completely object-oriented, and not “statically typed”. We do not need to declare variables before using them or declare their type. Every variable in Python is an object. That means, it automatically declares it according to what value the variable is given.

for example,

a = 1
b = "two"
c = True
d = "this is sentence"

we haven't declared the datatype of the variable, but to find what data type the variable is assigned, we will use type(), which returns the class / data type of the variable.

print(type(a))
print(type(b))
print(type(c))
print(type(d))

you can do all arithmetic operations as well, for example:

a = 10
b = 10
sum = a+b
print(sum)
# or you could just simply print the sum directly:
print(a+b)
# same method goes for other operations also, like
print(a-b) # Subtraction
print(a*b) # Multiplication
print(a/b) # division
print(a%b) # Modulus : gives remainder of a / b

Not every time hard-coded values are necessary, sometimes values of variables are different for different operations, and this method is not good for such operations, so, one needs to make a formula for the required operation and then require input from the user. So let's learn how to get input from users. It is done by using the input() command.

print("Enter value of a")
a = input()
print("Enter value of b")
b = input()
sum = a+b
print("Value of a =", a)
print("Value of b =", b)
print("Value of sum =", sum)
# you could also use input statement in this way:
b = input("enter any no. ")
print(b)

Once you’ve learned the basics, you can start developing small projects like calculator, tic-tac-toe, number guessing, rock-paper-scissors, etc. There are several good resources available on the web. As for the basics, you can rely on:

--

--

Simarpreet Singh

Tech enthusiast, Psychology lover , Pogonophile, Ambidextrous