As promised here I am with a new blog post on Python programming where we are going to discuss the below points today:-
- Data types
- Operators
- Variable creation
- Python Syntax - Why is it necessary?
Data types
Python has some commonly used data types.
- Numbers
x = 1.3 //float y = 1 // integer z = 1 + 2j //complex number
- Words
x = "Hello World!" //Represented with double quotes y = 'I am a dev' //Represented with single quotes z = 'Roger\'s dog said "woof"'
- Booleans
These are easy to understand once you start playing around with them in the python editor.x = True y = False
Operators
There are a different sets of operators provided by a python that can be used to manipulate data and get a result out of it.
Arithmetic operators
As you can see in the above screenshot we have 7 commonly used arithmetic operators that are
+, -, *, /, **, %, and //
These can be used to get the desired result on the numbers.
Comparion operators
Some of the most commonly used comparison operators are
< //Less than
> //Greater than
== //Equal to
<= //Less than or equal to
>= //Greater than or equal to
!= //Not equal to
is //Object identity
is not //Negated object identity
Boolean operators
Some of the commonly used boolean operators are
or //if value_1 or value_2 are true
and //if both value_2 and value_2 are true
not //if value_1 is not full
Variable creation
Python is pretty clean when it comes to variable creation. A variable shall start with _ or a letter. You can not have a variable starting with a number of special characters.
- You can camelCased variable name
- You can have a variable name starting with _ or a letter
Python code syntax
Unlike other programming languages, Python strictly follows the syntax. For example, in the screenshot below, you could see that I am trying to assign a letter to a number, and it yells at me.
Some of the best resources to begin your Python learning are:-
In the next blog post, we will learn about the basic building blocks of Python like Numbers, Text and Dates. Till then goodbye and take care.
Let's learn and grow ourselves. Thanks everyone in advance for reading this article !!