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

Python programming 2nd

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 18 Anúncio
Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Python programming 2nd (20)

Anúncio

Mais recentes (20)

Python programming 2nd

  1. 1. Python programming
  2. 2. Types of programming languages • Broadly, any programming language in the world can be classified into 2 types: • Compiler based languages • Interpreter based languages • Parameters of differences between these types are: memory required, time required, process of execution. • No types is best. Depends on the application. Both have their own advantages and disadvantages
  3. 3. Program compilation process • The program source code passed to compiler which compiles the code and converts it to object file. • At this stage, syntaxes, datatypes of variables, function calls are checked. • Object file contains binary code. • This file is then linked with runtime library files by the linker and converted to executable file.
  4. 4. Difference between compiler and interpreter • Compiler generates intermediate object code which further requires linking. • Therefore it takes more memory to store the object file. • In Interpreter, no intermediate object code is generated. • Compiler scans the entire program and translates it as a whole into object code • Interpreter translates the program one statement at a time.
  5. 5. • Compiler based languages are faster in execution as executable file is already generated. • Interpreter based languages are slower because they have to compile and execute at runtime
  6. 6. Difference summary
  7. 7. Quiz • Go to slido.com • Enter event code : Q842 • Answer the question.
  8. 8. Python is an interpreter based language.
  9. 9. Lets dive into python programming • Get python on your laptop. • Create virtual environment for python.
  10. 10. Steps for installing python • Check if python is already installed : • python3 –version • Download Python for mac. Install it. • Check the version of pip installed
  11. 11. Steps for creating virtual environment • Install Pip. (Python Package Installer): • sudo easy_install pip • Install virtualenv • sudo pip install virtualenv • Navigate to where you want to store your code. You have two options: • cd ~/Desktop • mkdir Development • cd Development • source venv/bin/activate
  12. 12. Basic syntax • print : to print on command line • Accepting input from command line: • input() • Store input from user: • User_input = input() • Printing Instructions for user to input : • User_input = input(“Enter your height.”)
  13. 13. Comments in python • # is a single line comment. • “””….””” is multi line comment
  14. 14. Variable names rules • A variable name must start with a letter or the underscore character • A variable name cannot start with a number • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) • Variable names are case-sensitive (age, Age and AGE are three different variables)
  15. 15. Quiz • Go to slido.com • Enter event code : V938
  16. 16. Output Variables • The Python print statement is often used to output variables. • To combine both text and a variable, Python uses the comma(,) character:
  17. 17. Get practical • Write a code for taking input from the user and print that value.

×