By the end of this article you would learn the following;
What is python, its origin and its application.
The advantages of python as compared to other languages.
Explain with examples the use of data types and
Explain the use of functions and methods in python.
Explain basic control flow if/else statements.
WHAT IS PYTHON
Nowadays PYTHON is one of the most popular programming languages(PL).
Python is an interpreted high level, general purpose programming language. Its design philosophy emphasis code readabilaty with use of indentation.
The PL PYTHON was designed in the late 1980`s by GUIDO VAN ROSSUM. It was first released in 1991 as PYTHON 0.9.0. for the past years different versions of python have been released and the newest version was released in 2020 which is python 3.9.
FIELDS OF APLICCATION OF PYTHON
Since PYTHON is a general purpose PL it can be used in many fields like;
AI and Machine learning
Advantages of python as compared to other languages.
Python is a user friendly PL.
Taking a PL like C we notice that python takes less lines so as
to perform a certain task.
Getting started with python programming.
You can get the link here
Once installed you can get the version of python installed by opening the cmd(comand prompt) in windows or the terminal in UNIX and then type python --version
Also there are different IDE`s one can use such as VScode, Anaconda, Spyder, Pycharm just to name a few.
Now that we are done with the installation let us dive into coding.
In order to begin with any programming language we need to first look at the basics.
Variables and Data types
A Variable is a storage location paired with an associated symbolic name, which contains some known or unknown quantity of information refered to as value.
it can be a word or a sentence or even a letter but not a number depending on the programer that is used to store a known or an unknown value..
`gender=" female" name='DIVINE'`
from the above gender and name are variables.
Rules for naming variables.
you should not start a variable with numbers.
19gender is a wrong variable.
special characters like $,!, /, \, # should not be added to your variable.
your variable name should not be seperated. We only seperate variables using an underscore(_).
In python variables are case sensitive..
Numerical data type
You can learn more about each of these data types here
functions and methods
A function is a block of code that runs when it is called.
a function is defined with the def keyword.
Learn more about functions here
n Object-Oriented Programming, we have objects. These objects have both properties and behavior. Morover, properties of the object are defined by the attributes and the behavior is defined using methods.
we have 3 types of methods which are
Learn more about methodshere
Basic control flow and if/else statements
In python, control flow or flow control statements refers to the order in which a code is being executed.
They inchude:while, for, if.
Also control is regulated by conditional statements, loops and function calls.
Simple if/else statement.
Decision making is required when we want to execute a code only if a certain condition is satisfied.
`if condition: code else: code `
learn more about control flow statements here..
THANK YOU FOR READING
Top comments (0)