Posts

Python Data Types

Image
Definition A datatype represents the type of data stored in computer memory or variable. The datatypes which are already available in Python are called  Built-in  datatypes, and that created by programmer is called  User-defined  datatype Now we will study each datatype with examples. Built-in Datatype Their are 5 different types of Built-in datatype: None Type Numeric Types Sequence Sets Mapping None Type The 'None' datatype in Python represents an object that does not contain any values. Same like 'null' in Java.  In Python only one None object is provided. One of it's use is, it can be used inside function as a default value to arguments. While calling function no value is passed, then the default value taken is 'None'. Numeric Types The sub-Types of Numeric datatype is int (integer) float (decimal point number) complex (real and imaginary number) bool (Boolean)  Integer (int) As the name suggests the variab...

Python Variables , Python Identifiers and Python statements

Image
Variables Variables are reserved memory location in computer used to store values. You can store different data type in variables, like integer, float, string etc... Python automatically reserves the memory location for each variable.  Identifiers The name given to entities like variable, function, objects etc., is called Identifiers. Variables and Identifiers are not same, but name given to a variable is called Identifier, but variables also has different properties like value, type, scope and so on....  Valid Identifier Name Identifiers care case sensitive It only contains Letter, Numbers and underscore It cannot start with numbers It cannot use space between two names. eg: Area of rectangle = 30 but use "_" : eg:  Area_of_rectangle = 30 Name cannot be same as Python Keywords. Python Keywords Some Suggestions  Use descriptive identifiers to name your variable. When your identifiers (variable name) has more than one wor...

Programs and Algorithms in Python

Algorithm An algorithm is description to solve a problem. It is a step by step process to solve any kind of problem. Their can be different algorithms to solve same problem. It varies from person to person Algorithm is written and analyzed in different programming language. Example If you want an do arithmetic addition of two numbers and save it to a location, then algorithm will be Step 1: Take one number and save it to a variable named 'a'. Step 2: Take another number and save it to a variable named 'b'. Step 3: Simply perform a+b and save it to variable named 'x'.              So equation for this step will be x = a+b; Step 4: Display value of x. Now, above algorithm can be implemented in any kind of programming language. Programs A program is implementation of  algorithm in any programming Language, which in our case is Python. You can also say it is sequence of instructions given to computer to execute ...

Python Basics

Image
Before starting reading this blog make sure you have installed latest Python IDLE. If not go to Downloads and follow the given steps. This Post will have basic Python statements to start with Python IDLE. Few instructions are given below try typing it in your IDLE to understand how Python works. At the end of post you will get few practice questions. So lets start Pythonior's.......  Step 1: Open Python IDLE Step 2 : Start typing below statements. Simple Calculation  >>> 3+4  (press enter after every statement) 7 >>> 3*9 27 >>> 5/2 2.5 >>>6-2 4 Compound Statement >>>(2+4)*(3/2) 9.0 Variable Assigning >>> x=5+6 It will not show anything but will remember value of x=11 Similarly, >>>y=2*4 Now, if you type >>> x + y 19        (result of adding two variable) String String is series of characters >>...

Step By Step Guideline for Installing Python on Windows

Image
Step 1. Go to www.python.org Step 2. Select "Downloads" and click on "View the full list" Step 3.  Select Python 3.7.x or any version of python 3 that is higher. Step 4. Select the proper file (if your machine is 64 bit, select "Windows x86-64 executable installer) and download it Step 5.  click on Install Now Wait Until Python installs Step 6. Then you should see the completion message on your screen. Click Close Now you can start programming in Python.  You can use Python Shell or Python IDLE.  I prefer to go with Python IDLE, because it allows you to do graphical user interfaces and has menu on the top. Find the video of installation of Python IDLE on my channel. This video is for installation for windows 7 which is same as that given in post which is for windows 8.1

Python Compiler

Image
Types of Python Compilers... Compilers are useful to integrate various programming Languages into Python. Some of them are follows:- Types of Python Compiler CPython: It is a standard Python compiler implemented in C Language. In this compiler Python code is converted into byte code using C. This code is then run on PVM(Python Virtual Machine). Advantage of this compiler is you can execute C and C++ functions and programs in CPython. Jython:  It is designed to run on Java platform. It first compiles Python program into Java byte code. It is executed by JVM(Java Virtual Machine) to produce output. It contains Library which is useful for both Python and Java programmers. IronPython: This is compiler on .NET framework. This is written in The Python program when compiled gives an intermediate language(IL) which runs on Common Language Runtime(CLR) to get output. It contains both Python and .NET libraries. PyPy: This compiler is actually written in RPyt...

What is Python?

Image
WHAT IS PHYTHON? C + JAVA = PYTHON; i.e. Procedure + Object oriented = PYTHON Combing features of C programming and Java is a Python programming Language. Definition: Python is an interpreted, high-level, general-purpose programming Language. In simple words, Python is a programming Language in which most of program executes instructions directly without converting it to machine Language instruction, it automates lots of areas of program execution like memory management and is used to design various applications in many different fields like Machine Learning, Web designing, Image Processing, Embedded applications, Artificial intelligence and so on....  FEATURES OF PYTHON:  Their are many features of Python, But i'll be discussing only five (which I feel are important to know before starting to learn python) features here which will make you interested and help to start learning Python. Simple: It is very simple Language to start learning anytime, anywhere. ...