DataTypes in python_part2

In this article, I'll explain about tuple, set and dictionary datatypes in Python


Tuple
                                   The tuple is exactly the same as list data type except that it is immutable, means we cannot change values once values are assigned.To create a tuple, just list the values within parenthesis separated by commas.


Set
                                     SET is an unordered collection of unique elements. It is used in membership testing, removing duplicates from a sequence, and computing mathematical operations such as intersection, union, difference, and symmetric difference.

There are currently two types of sets
      • Set
      • Frozen Set
Set is mutable means we can change elements after assigning elements to variables.

An example for Set


                                         


Frozen Set is immutable means we cannot change elements after assigning.

An example for Frozen Set





Mathematical operations on the set
        • Union
        • Intersection
        • Difference
        • Symmetric difference

Union
                                       We can use this union() function to return all elements present in both sets.

Example for union()

Intersection

                                      A set with all the elements which are contained in both sets is returned or Returns common elements present in both sets.


An example for intersection

Difference

                                      Returns the elements present in set a but not in set b or difference() method returns the set difference of both sets a and b.

An example for difference


Symmetric_Difference

                                       Returns elements present in either set a or set b but not in both sets.

An example for Symmetric_difference


          
Dictionary
                                      
                                        A dictionary is a sequence of items. Each item contains a key and a value. Dictionaries are not sorted.

An example for Dictionary








Thank you for taking the time to read my article.




                                         
                             



















DataTypes in Python_part1

In this article, I will explain about Numbers, String, and List

Data types
                Every value in Python has a datatype. Everything in Python programming is an object.

In Python Scripting/programming Language datatypes are classified into 6 types.
      • Numbers
      • String
      • List
      • Tuple
      • Set
      • Dictionary
Numbers

                      Number data types store numerical values. Numerical objects are mutable means we can change its value after assigning.



Python supports three different numerical types
      • int
      • complex
      • float
Integer(int)
                          Integer or INT in Python, is a whole number, positive or negative, without decimals.
for example


Float
                         Float or floating point number is a number it may be positive or negative which contains one or more decimals. Floating-point numbers are based on scientific notation, where numbers are written as a mantissa and an exponent.


Complex
                         
                         A complex number is created from two real numbers. Python complex number can be created using complex(a,b) function as well as using direct assignment statement. Python provides useful tools to handle and manipulate them.
                         A complex number is represented by  ' a + bi  '.
                        'i' denotes the imaginary part.      



String
                             We can’t perform mathematical operations on strings, even if the strings have numerical values. The addition (+) operator performs string concatenation, which means it combines two other strings.

String Concatenation example
List

                                          A list is a datatype which holds comma-separated values between square brackets[ ] where items need not to be the same datatype. It allows duplicate elements and it is mutable means we can change values after assigning.
An example for list assigned with different datatypes









                                                                                                                                      to be continued...


Thank you for taking the time to read my article






Identifiers,constants in Python


Identifier
                 A name in the Python program is called an identifier. It can be a class name or function name or variable name. 

For example
                 identifier1=256
Here, identifier1 is the name given to the value 256

Rules to follow when defining an identifier
  • Alphabet symbols(either lower case or upper case or mixed) and underscore symbol(_).
  • digits(0 to 9) .
Yes, Python is a case-sensitive language
for example
Note
               Code is writing in Python2 if u want to write the same code you have to use parentheses() in print statements.


Constants
          Fixed values such as numbers and letters are called constants. Constants usually declared and assigned to a new file containing variables, functions, etc which is imported to the main file and constants are written in capital or block letters or underscore's.

Example
MIN_VALUE=7 


Thank you for taking the time to read my article.


  


 




Characteristics of python,companies who use python and where can we use python


Characteristics of Python
  • General-purpose programming
  • Automatic memory management
  • It has a large and comprehensive standard library
  •  Python is a strong high-level language
  • Python is interpreted
  • Python is reflective
  • It is a dynamical type
  • It is an open source
  • Automatic garbage collection.
Giant companies who use Python

Image source: Google

Where we can use Python
        We can use it everywhere. The most common important application areas are 
  • For developing Desktop Applications
  • For Machine Learning
  • For Artificial Intelligence 
  • For Web Applications
  • For Data Analysis Applications
  • We can use in Networking
  • For Testing
  • Many Open Source Frameworks and Tools
  • For developing video games like world of tanks invincible, battlefield 2, civilization 4, etc 
  • For IOT ... 
                       NASA and Newyork Stock Exchange Applications developed by Python. 




Thank you for taking the time to read my article.

Advantages and Disadvantages of Python


Major advantages of scripting languages
      •  Easy to learn and use
      •  Allows the addition of dynamic and interactive activities to web pages
      • Allows complex tasks to be performed in relatively few steps
      • It allows users & programmers to create and interpret in many text editors.

Image source: Google

First of all, we discuss disadvantages in python and then advantages... 


Disadvantages of Python

  • Speed Limitations
                      We know that Python code is executed line by line because Python uses interpreter, it results in slow execution. 
  • Weak in Mobile Computing and Browsers
                      While it serves as an excellent server-side language, Python is much rarely seen on the client side. 
  • Design Restrictions
                      Python is dynamically typed. It means that you don’t need to declare the type of variable while writing the code. While this is easy during coding, it can raise run time errors.
  • Underdeveloped Database Access Layers
                       Compared to more widely used technologies like JDBC (Java DataBase Connectivity) and ODBC (Open DataBase Connectivity), Python’s database access layers are a bit underdeveloped. Consequently, it is less often applied to huge enterprises.



Advantages of Python
  • Easy learning and Support Available
                        Python offers excellent readability and simple-to-learn syntax which helps beginners. Additionally, the wide base of users and active developers has resulted in the internet  to encourage development.

  • Presence of Third Party Module

                       The Python Package Index (PyPI) contains numerous third-party modules that make Python capable of interacting with most of the other languages and platforms.
  • High- Level Language
                         It is a high-level language. When you write programs in python, you don’t need to remember the system architecture, nor do we need to manage the memory, this makes it more programmer friendly.
  • Extensive Support Libraries
                         Python provides a large standard library which includes areas like internet protocols, string operations, web services tools and operating system interfaces. 
  • Open Source and Community Development
                          Python language is developed under an OSI-approved open source license, which makes it free to use and distribute, including for commercial purposes.
  • User-friendly
                          Python has built-in list and dictionary data structures which can be used to construct fast runtime data structures.
  • Productivity and Speed
                          Python has a clean object-oriented design. Python is considered a viable option for building complex multi-protocol network applications.
  • Dynamically Typed
                          Python is dynamically typed, this means that the type for a value is decided at runtime, not while writing code. So, you don’t need to specify the type of data while declaring it.
  • Portability
                          If you have written a Python code for windows machine. If you want to run on a Mac, you don’t need to change to it for the same. You can take one code & run it on any machines. This makes Python a portable language.
  • Extensible
                          Python can be extended to other languages. You can write some of your code in languages such as C++ or C, this comes in handy especially in projects.
  • Object-Oriented
                          Python supports both procedure-oriented & object-oriented programming is one of the key python features. Functions help us with code reusability, classes, & objects.
  • Official Download website provided below

https://www.python.org/downloads/


Thank you for taking the time to read my article.


History and introduction to Python


Introduction:

                        Guido Van Rossum is the author of Python language, an interpreted, interactive object-oriented programming language. In the late 1980s, Guido Van Rossum began work on Python at the National Research Institute of Mathematics and Computer Science in the Netherlands, or Centrum Voor Wiskunde en Informatica(CWI) as it is known in Dutch. Since then, Python has become very popular among developers, who are attracted to its clean syntax and reputation for productivity.
                        From one’s perspective, you can say Python is a very high-level scripting language. From another perspective, you can say it's a high-level programming language that happens to be implemented in a way that emphasizes interactivity.




History:
ABC influence on Python

                         In the early 1980s, Guido Van Rossum worked as an implementer on a team building a language called ABC at Centrum voor Wiskunde  Informatica (CWI). Van Rossum try to mention ABC's influence on python and learned during that project and to the people who worked on it.
                       
                          ABC's design had a very clear, sharp focus. ABC was intended to be a programming language that could be taught to intelligent computer users who were not computer programmers or software developers in any sense.During the late 1970s, ABC's main designers taught traditional programming languages to such an audience. Their students included various scientists—from physicists to social scientists to linguists—who needed help using their very large computers. Although intelligent people in their own right, these students were surprised at certain limitations, restrictions, and arbitrary rules that programming languages had traditionally set out. Based on this user feedback, ABC's designers tried to develop a different language.


Python Is Born
                              In 1986, GuidoVan Rossum moved to a different project at CWI, the Amoeba project. Amoeba was a distributed operating system. By the late 1980s they found that they needed a scripting language. Around that same time, personal computers became available. Personal computers had all this wonderful packaged software. 

Extensibility in Python
                    For Python, Van Rossum felt extensibility was obviously a great thing to have. VanRossum want to use Python on different platforms. Van Rossum wanted to use Python on Amoeba, the operating system they were developing, and on UNIX. Van Rossum also wants to give support to Windows and Macintosh
                               Python is usually implemented in C or C++, but some people use Fortran to write their extensions that will link to large Fortran libraries.
Latest Versions:

Python2 -2.7.16

Python3-3.7.3(3.8 is under development)


Note:
                              From 2020, python2 is no longer supported, officially announced by PSF(Python Software Foundation).

Thank you for taking the time to read my article.