Python is a clear and powerful objectoriented programming language, comparable to Perl, Ruby, Scheme, or Java. In my last blog we have discussed the key features of python. Now we are going to dive into the programming concepts of python. In this blog we will discuss about data types used in the python
Data Types
Data types are the classification or categorization of data items. It represents the kind of value a particular variable can hold and tells what operations can be performed on that particular data.
Since everything is an object in Python programming, data types are actually classes and variables are instance (object) of these classes. The type of a variable in the python is decided by the type of value assigned to that variable.
Example:
# type() function is used to identify the datatype of variable or object.
>>> x = 10
>>> type(x)
<class 'int'>
>>> x = 10.0
>>> type(x)
<class 'float'>
>>> x = 5+8j
>>> type(x)
<class 'complex'>
>>> x = 'Mukesh'
>>> type(x)
<class 'str'>
>>> x = ['Mukesh','Kumar']
>>> type(x)
<class 'list'>
>>> x = ('Mukesh', 'Kumar')
>>> type(x)
<class 'tuple'>
>>> x = {'fname':'Mukesh', 'lname':'Kumar'}
>>> type(x)
<class 'dict'>
>>>
Builtin data type of python are as follows:
Let us discuss about Numeric Data type
Numbers
The Python interpreter acts as a simple calculator, You can write an expression and interpreter will display the value. Expression syntax is straight forward: the operators +, , * and / work just like in most other languages (for example, Pascal or C); parentheses (()) can be used for grouping.
Examples
>>> 7 + 3
10
>>> 70  5*6
40
>>> (70  5*6) / 4
10.0
>>> 9 / 5 # division always returns a floating point number
1.8
There are three distinct numeric types: integers, floating point numbers, and complex numbers. In addition, Booleans are a subtype of integers.
Integers
This value is represented by ‘int’ class. It contains positive or negative whole numbers (without fraction or decimal). In Python there is no limit to how long an integer value can be.
Float
This value is represented by ‘float’ class. It is a real number with floating point representation and specified by a decimal point.
Complex Numbers
Complex number is represented by ‘complex’ class. It is specified as (real part) + (imaginary part)j. For example – 5+8j
Basic Operations on Numeric Type
The integer numbers (e.g. 2, 4, 20) have type ‘int’, the ones with a fractional part (e.g. 5.0, 1.6) have type ‘float’.
Division (/) always returns a float. To do floor division and get an integer result (discarding any fractional result) you can use the // operator; to calculate the remainder you can use %:
Examples
>>> 7+3 # addition operator
10
>>> 73 #minus operator
4
>>> 7*3 #multiplication operator
21
>>> 17 / 3 # classic division returns a float
5.666666666666667
>>>
>>> 17 // 3 # floor division discards the fractional part
5
>>> 17 % 3 # the % operator returns the remainder of the division
2
>>> 5 * 3 + 2 # result * divisor + remainder
17
With Python, it is possible to use the ** operator to calculate powers
>>> 5 ** 2 # 5 squared
25
>>> 2 ** 7 # 2 to the power of 7
128
The equal sign (=) is used to assign a value to a variable. Afterwards, no result is displayed before the next interactive prompt:
>>> width = 20
>>> height = 5 * 9
>>> width * height
900
If a variable is not “defined” (assigned a value), trying to use it will give you an error:
>>> n # try to access an undefined variable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'n' is not defined
There is full support for floating point; operators with mixed type operands convert the integer operand to floating point:
>>> 4 * 3.75  1
14.0
In interactive mode, the last printed expression is assigned to the variable _. This means that when you are using Python as a desk calculator, it is somewhat easier to continue calculations, for example:
>>> tax = 12.5 / 100
>>> price = 100.50
>>> price * tax
12.5625
>>> price + _
113.0625
>>> round(_, 2)
113.06
This variable should be treated as readonly by the user. Don’t explicitly assign a value to it — you would create an independent local variable with the same name masking the builtin variable with its magic behavior.
All numeric types (except complex) support the following operations:
Operation  Result  Full documentation 
x + y  sum of x and y 

x – y  difference of x and y 

x * y  product of x and y 

x / y  quotient of x and y 

x // y  floored quotient of x and y 

x % y  remainder of x / y 

x  x negated 

+x  x unchanged 

abs(x)  absolute value or magnitude of x  
int(x)  x converted to integer  
float(x)  x converted to floating point  
complex(re, im)  a complex number with real part ‘re’, imaginary part ‘im’. im defaults to zero.  
c.conjugate()  conjugate of the complex number c 

divmod(x, y)  the pair (x // y, x % y)  
pow(x, y)  x to the power y  
x ** y  x to the power y 

Wordpress: https://itsengg.home.blog/2020/01/30/datatypesinpythonnumericdatatype/
Blogspot: https://itsengg.blogspot.com/2020/01/datatypesinpythonnumericdatatype.html
Weebly: https://itsengg.weebly.com/blog/datatypesinpythonnumericdatatype
Tumblr: https://itsengggn.tumblr.com/post/190545115905/datatypesinpythonnumericdatatype
Programming languages for Beginners
21^{st} century is the time of digital revolution. The data is the only assets of every ones interest. Now it is important to identify the best suitable area for a computer science engineer to set his path for journey of success.
In this digital world, there is a large set programming language. To choose a suitable programming language as per one’s interest is a difficult task for a beginner. This blog is trying to figure out some of top programming language as per industry demand. Before start talking about Programming Languages let me clarify that:
· It is ones choice to prefer a particular language that is better than any other.
· Developer may have a mix of flavor of multiple languages.
Recent Programming languages are enriched with a lot of new enhanced features. This exponential enhancement in features may trigger to common question amongst beginners that which programming language they should choose to learning so that he will be in industry demand.
Here, is a list of top 10 languages that you should learn –
• Python
• JavaScript
• Java
• Swift
• GoLang
• C#
• C++
• Scala
• Kotlin
• Ruby
In this series let discuss about Pyhton
Python
Python language is developed by Guido van Rossum.
Python was released in 1991. Python is a rapidly grown general purpose programming language. You can use Python for developing desktop GUI applications, websites and web applications. Python is an interpreted language. It is highly objectoriented programming language. Python is also a highlevel programming language with dynamic semantics. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed.
Python has following features
· It is a Opensource programming language
· Focuses on code readability
· Has userfriendly data structures
· Support GUIbased desktop applications
· Have extensive Support Libraries, support modules and community development.
Reasons for Demand
· Ideal for Desktop GUIs, Web and Internet Development.
· Efficiently used for Scientific, Numeric and Business applications.
· It is widely used in AI and Machine Learning space.
· Python is a good choice for Data Analytics and Data Science as it has packages such as NumPy and SciPy that are commonly used in the fields of scientific computing, mathematics, and engineering.
· Pythonbased web development frameworks like Django, Pyramid, and Turbo Gear are easy to learn, featurepacked and popular.
· Highly demanding in the job market.
Limitations
· Not ideal for Mobile Computing
· It is slower due interpreted programming language
· Due Use of a global interpreter lock(GIL), Python is not a good choice for parallel computing intensive application thus exhaustive multithreading in python is poor.