Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts.

Similar presentations


Presentation on theme: "Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts."— Presentation transcript:

1 Python Basics

2 Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts M T Savaliya

3 Features History Developed by Guido Van Rossum First public distribution – 1991 Versions Python 1.0 – 1994 Python 2.0 – 2000 Python 3.0 - 2008 M T Savaliya

4 Features Important Features Simple Open Source High-level Portable Object Oriented and Procedure Oriented Interpreted Easy to maintain Scalable M T Savaliya

5 How does Python work ? Editor -> Source File -> Interpreter -> Running Libray Modules M T Savaliya

6 Python Execution Source File (.py) Byte Code (.pyc) Runtime PVM M T Savaliya

7 Implementations CPython Written in C Language Standard library written C and Python Bycode compiled by CPython VM JPython From Java Platform Uses Java classes Complied to Java Byte code run by JVM Python.NET M T Savaliya

8 Installation and IDLE Install from https://www.python.org Python IDLE (Python Integrated Development and Learning Environment) M T Savaliya

9 Basic Syntax Comments : starts with # Data types Numerical Integer Float Complex Boolean Compound (Sequences) String : Operations -> index, slice, concatanation List : use [ ] Tuple : use (), Immutable Identifiers, Keywords, Variables M T Savaliya

10 Input/Output Input : input() function Example : x = int(input(‘Enter a number : ‘)) Output : print() function Examples: print(x) print(x,y) print(x,y,sep=‘%’) print((“Value of x is”,x) print(“Value of x is {}’.format(x)) M T Savaliya

11 Operators Arithmetic operators + : Addition and concatenation - : Subtraction and difference * : Multiplication and repetition of data types / : Division % : Remainder ** : Power // : floor value of numbers Relational Operators : ==, !=, >, >=, <, <= M T Savaliya

12 Operators Logical : and, or, not Bitwise : &, |, ~, ^, >>, << Assignment : =, +=, … Membership : in, not in Identity (Memory Location) : is, not is Precedence and Associativity is Important M T Savaliya

13 Control Statements Conditional Statement If-elif-else (#calc) (#larger) Looping for loop (#fact) for iterating_var in sequence: statement(s) while loop while test_expression: statement(s) M T Savaliya

14 Control Statements break and continue statements else clause with for and while loop (#prime) M T Savaliya

15 Function Independent piece performing well defined task Supports Modularity Syntax def name(parameter list) statement(s) return [expression] Calling a function name(parameters) Or var = name(parameters) M T Savaliya

16 Function Parameters Format parameters Actual parameters Arguments Default Keyword Arbitrary Recursion M T Savaliya

17 Function Anonymous or lambda functions lambda arguments: expression Scope of variable Local Global M T Savaliya

18 References: Star Python, STAR Certifications Programming Through Python, Savaliya, Maurya, Magar, STAREDU Solutions Examples: https://www.programiz.com/python- programming/examples M T Savaliya


Download ppt "Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts."

Similar presentations


Ads by Google