Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python INTRODUCTION

Similar presentations


Presentation on theme: "Python INTRODUCTION"— Presentation transcript:

1 Python INTRODUCTION

2 Brief History of Python  Python is a widely-used general-purpose, high- level programming language. It was initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code.

3  In the late 1980s, history was about to be written. It was that time when working on Python started. Soon after that, Guido Van Rossum began doing its application-based work in December of 1989 at Centrum Wiskunde & Informatica (CWI) which is situated in the Netherlands. It was started firstly as a hobby project because he was looking for an interesting project to keep him occupied during Christmas.

4  The language was finally released in 1991. When it was released, it used a lot fewer codes to express the concepts, when we compare it with Java, C++ & C. Its design philosophy was quite good too. Its main objective is to provide code readability and advanced developer productivity. When it was released it had more than enough capability to provide classes with inheritance, several core data types exception handling and functions.

5  For various purposes such as developing, scripting, generation, and software testing, this language is utilized. Due to its elegance and simplicity, top technology organizations like Dropbox, Google, Quora, Mozilla, Hewlett- Packard, Qualcomm, IBM, and Cisco have implemented Python.

6 Features of Python  Free and Open Source Python language is freely available at the official website and you can download it from the given download link below click on the Download Python keyword. Download Python Since it is open- source, this means that source code is also available to the public. So you can download it, use it as well as share it.  Easy to code Python is a high-level programming language. Python is very easy to learn the language as compared to other languages like C, C#, Javascript, Java, etc. It is very easy to code in the Python language and anybody can learn Python basics in a few hours or days. It is also a developer- friendly language.

7  Easy to Read As you will see, learning Python is quite simple. As was already established, Python’s syntax is really straightforward. The code block is defined by the indentations rather than by semicolons or brackets.  Object-Oriented Language One of the key features of Python is Object-Oriented programming. Python supports object- oriented language and concepts of classes, object encapsulation, etc.  GUI Programming Support Graphical User interfaces can be made using a module such as PyQt5, PyQt4, wxPython, or Tk in python. PyQt5 is the most popular option for creating graphical apps with Python.

8  High-Level Language Python is a high-level language. When we write programs in Python, we do not need to remember the system architecture, nor do we need to manage the memory.  Extensible feature Python is an Extensible language. We can write some Python code into C or C++ language and also we can compile that code in C/C++ language.

9  Easy to Debug Excellent information for mistake tracing. You will be able to quickly identify and correct the majority of your program’s issues once you understand how to interpret Python’s error traces. Simply by glancing at the code, you can determine what it is designed to perform.  Python is a Portable language Python language is also a portable language. For example, if we have Python code for windows and if we want to run this code on other platforms such as Linux, Unix, and Mac then we do not need to change it, we can run this code on any platform.

10  Python is an Integrated language Python is also an Integrated language because we can easily integrate Python with other languages like C, C++, etc.  Interpreted Language: Python is an Interpreted Language because Python code is executed line by line at a time. like other languages C, C++, Java, etc. there is no need to compile Python code this makes it easier to debug our code. The source code of Python is converted into an immediate form called bytecode.

11  Large Standard Library Python has a large standard library that provides a rich set of modules and functions so you do not have to write your own code for every single thing. There are many libraries present in Python such as regular expressions, unit-testing, web browsers, etc.  Dynamically Typed Language Python is a dynamically-typed language. That means the type (for example- int, double, long, etc.) for a variable is decided at run time not in advance because of this feature we don’t need to specify the type of variable.

12  Frontend and backend development With a new project py script, you can run and write Python codes in HTML with the help of some simple tags,, etc. This will help you do frontend development work in Python like javascript. Backend is the strong forte of Python it’s extensively used for this work cause of its frameworks like Django and Flask.  Allocating Memory Dynamically In Python, the variable data type does not need to be specified. The memory is automatically allocated to a variable at runtime when it is given a value. Developers do not need to write int y = 18 if the integer value 15 is set to y. You may just type y=18.

13

14 MS-DOS

15 conda

16 What is conda  Is a open source cross platform language diagnostic package management system usefull in installing packages in developing a python

17 To run @ msdos prompt jupyter notebook (1)

18 To run @ Anaconda Navigator jupyter notebook (2)

19 PyCharm by Jetbrains

20 Creating Folder: Jupyter Notebook 1.In jupyter notebook click desktop icon 2.Inside desktop icon click New button 3.In New dropdown box click folder to create a directory 4.Click checkbox Untitled Folder and rename your folder to DS+family name 5.Then in the created folder name Click New button at dropdown choices click Python3 6.Type the python sample code 7.Print (“Hello World”) 8.Save your work as sample1

21 Data Structure and Algorithm INTRODUCTION TO ALGORITHMS AND DATA STRUCTURES

22 Algorithm Definition: - An algorithm is a Step By Step process to solve a problem, where each step indicates an intermediate task. Algorithm contains finite number of steps that leads to the solution of the problem.

23 Characteristics of an Algorithm Algorithm has the following basic properties: ◦Input-Output: Algorithm takes ‘0’ or more input and produces the required output. This is the basic characteristic of an algorithm. ◦Finiteness: An algorithm must terminate in countable number of steps. ◦Definiteness: Each step of an algorithm must be stated clearly and unambiguously. ◦Effectiveness: Each and every step in an algorithm can be converted in to programming language statement. ◦Generality: Algorithm is generalized one. It works on all set of inputs and provides the required output. In other words, it is not restricted to a single input value.

24 Categories of Algorithm Based on the different types of steps in an Algorithm, it can be divided into three categories, namely: 1.Sequence 2.Selection and 3.Iteration

25 Sequence: The steps described in an algorithm are performed successively one by one without skipping any step. The sequence of steps defined in an algorithm should be simple and easy to understand. Each instruction of such an algorithm is executed, because no selection procedure or conditional branching exists in a sequence algorithm.

26 Example: Adding two numbers Step 1: start Step 2: read a,b Step 3: Sum=a+b Step 4: write Sum Step 5: stop

27 Sample: using Jupyter Notebook

28 Sample: using PyCharm

29 Selection: The sequence type of algorithms are not sufficient to solve the problems, which involves decision and conditions. In order to solve the problem which involve decision making or option selection, we go for Selection type of algorithm.

30 Example: general format shown below if(condition) Statement-1; else Statement-2; The above syntax specifies that if the condition is true, statement-1 will be executed otherwise statement-2 will be executed. In case the operation is unsuccessful. Then sequence of algorithm should be changed/ corrected in such a way that the system will re- execute until the operation is successful.

31 Execise #1: person eligibility to vote Step 1: start Step 2: read Age Step 3: if Age >= 18 then Step 4 else Step 5 Step 4: write “ person is eligible for vote” Step 5: write “ person is not eligible for vote” Step 6: stop

32 Exercise #2: biggest among two numbers Step 1: start Step 2: read a, b Step 3: if a > b then Step 4: write “ a is greater than b” Step 5: else Step 6: write “ b is greater than a” Step 7: stop

33 Iteration Is a type of algorithms are used in solving the problems which involves repetition of statement. In this type of algorithms, a particular number of statements are repeated ‘n’ no. of times.

34 Example: Step 1 : start Step 2 : read n Step 3 : repeat step 4 until n>0 Step 4 : (a) r=n mod 10 (b) s=s+r (c) n=n/10 Step 5 : write s/r/n Step 6 : stop

35 Exercise #3: iteration Step 1: my_list = [1,2,3,4,5,6,7,8,9, 10] //declaring a variable my_list with set of elements Step 2: total = 0// initialize the value of total to 0 Step 3: for item in my_list:// for loop is used to go through all of the elements in my_list // item is implicit define and takes the value of my_list // for loop must be end with colon Step 4: total = total + item // every time the item go in your the list it adds the item in your list to your total Step 5: print (total)

36 Using Jupyter

37 Using PyCharm


Download ppt "Python INTRODUCTION"

Similar presentations


Ads by Google