O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Python programming introduction

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Python Tutorial Part 1
Python Tutorial Part 1
Carregando em…3
×

Confira estes a seguir

1 de 23 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Python programming introduction (20)

Anúncio

Mais de Siddique Ibrahim (20)

Mais recentes (20)

Anúncio

Python programming introduction

  1. 1. Basic Python Programming By S.P. Siddique Ibrahim AP/CSE 9/1/2019
  2. 2. Overview of Programming Languages • Machine Language: Bianary form i.e using only 0s and 1s. • Assembly Language: Machine operations are represented by mnemonic code(such as ADD & MOV) • High Level Language: Much easier to write than low level language because program instruction similar like English language.
  3. 3. High Level Language
  4. 4. Compiler • It is a software • Translate high level language code into machine language code(0s and 1s) • The compiled program is called object code. • It is a executable code does not need the compiler during execution.
  5. 5. Interpreter • Compiler converts all source code into machine code. • Where the interpreter reads the source code line by line and converts it into object code.
  6. 6. Linker • Linking the different program modules and libraries to form a single executable program.
  7. 7. Loader • Assign memory space in RAM for the program being executed.
  8. 8. Internal working of python Syntax checker and Translator Python Virtual Machine(PVM) Python code Byte code Input
  9. 9. STEPS • STEP1: Python interpreter reads a python code and verify it for syntax error. If it found any error, immediately halts the translation and shows an error message. • STEP2: If there is no error; interpreter translate a code into byte code • STEP3: Byte code is sent to the PVM. Here again the byte code is executed on PVM. If error found then the PVM halts and show the error message.
  10. 10. Commenting in Python • Python single line comment preceded by a hash symbol (#) • Three consecutive single quotation marks ‘’’ are used to give multiple comments (or) paragraph comments.
  11. 11. Example • # Now learn how to comment in Pyhon • Print (“I am learning Python”) • ‘’’Python tool • Is easy to • Learn’’’ • Print(‘bye’)
  12. 12. Python character set • Letters: upper case and lower case • Digits: 0,1…9 • Special symblos: _,{}[]()#*&^’”:; • White space(tnx0bx0cr) space, tab
  13. 13. Token Python Tokens Literals Delimit ers Operators Variables/Ide ntifiers Keywords
  14. 14. 1. Literal • Literals are numbers or strings or characters appear in the program. • Example: • 78 – Integer literal • 21.32- floating point literal • ‘q’- character literal • “Hello” – String literal • (Python also contain list and dictionary)-see later chapter
  15. 15. 2. Value and Type • To know type of any value in Python use in-build method called type(value) • Example: • >>>type(‘hello’) • >>>type(“hello”) • >>>type(123)
  16. 16. Keywords • Keywords are fixed meaning/reserved words. • Cannot be used as identifiers/variables. • Sample keywords: from, none, with, while, true, return, is , in, import, if , gloabl, for, finally, else….
  17. 17. Operator • Python contains various operators • Arithmetic - + - * / % ** • Relational == != <> <= >= • Logical and not or • Bitwise &~|^<< >>
  18. 18. Delimiter • It is symbol that perform special role in python like grouping, punctuation and assignment • () [] {} • , :. = ;
  19. 19. Variable • Identifier is the name used to find variable, function, class or other objects • Rules: • Character consists of letter, underscore, digits, • Can be any length • Starts with letter • Can start with _ • Cannot starts with a digit • Cannot be a keyword
  20. 20. Example • First name • 23name • For • Valid- name, _address, roll_no
  21. 21. The Print() Function • The task of print function is to display the contents on the screen • Print(argument) • >>>print(‘Hello welcome to python programming’) • Print(1000)
  22. 22. Print with quotation • Use ()-backslash • Print(“the attachment, ”remaining””)
  23. 23. Print with end argument • Print(‘hello’,end=‘’) • Print(‘world’,end=‘’) • Print(‘goodbye’)

×