Python Programming
Language
Session 1
Mohamed Abdula’al
Embedded Software Engineer at EL2
LinkedIn :
https://www.linkedin.com/in/mohamed-abdulaal/
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Introduction to programming language
Introduction to programming language
It’s a set of rules that provides a way of telling the computer what
operations to performs as it describe computation
Introduction to programming language
It’s a set of rules that provides a way of telling the computer what
operations to performs as it describe computation
English language has words, symbols and grammatical rules
Introduction to programming language
It’s a set of rules that provides a way of telling the computer what
operations to performs as it describe computation
English language has words, symbols and grammatical rules
Also programming languages has words and symbols and rule of
grammar
Introduction to programming language
It’s a set of rules that provides a way of telling the computer what
operations to performs as it describe computation
English language has words, symbols and grammatical rules
Also programming languages has words and symbols and rule of
grammar
The grammatical rules are called Syntax!
Introduction to programming language
It’s a set of rules that provides a way of telling the computer what
operations to performs as it describe computation
English language has words, symbols and grammatical rules
Also programming languages has words and symbols and rule of
grammar
The grammatical rules are called Syntax!
Each programming language has it’s own syntax rules.
Why there are so many languages
Why there are so many languages
• Different tools for different jobs!
-Ruby and java script are great job for web
sites
-C are good in Embedded systems
-Objective C used for developing ios applications
-C++ used to develop software, videos and games
and more
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Why python?!
Why python?!
Open source & free (Thanks Guidi van Rossum)!
Why python?!
Open source & free (Thanks Guidi van Rossum)!
Portable- works on every operating systems
Why python?!
Open source & free (Thanks Guidi van Rossum)!
Portable- works on every operating systems
Easy to learn
Why python?!
Open source & free (Thanks Guidi van Rossum)!
Portable- works on every operating systems
Easy to learn
No compilation necessary. Prototype and run!
Why python?!
Open source & free (Thanks Guidi van Rossum)!
Portable- works on every operating systems
Easy to learn
No compilation necessary. Prototype and run!
Powerful libraries
Why python?!
Open source & free (Thanks Guidi van Rossum)!
Portable- works on every operating systems
Easy to learn
No compilation necessary. Prototype and run!
Powerful libraries
Used for desktop, web applications ,write GUI interfaces,Mobile app
development and embedded systep design
Python process
Disadvantages of python
Disadvantages of python
It’s not very fast
Disadvantages of python
It’s not very fast
Some find the whitespaces in annoying
Lets start python
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Installing python
• Go to
www.python.org
Test python
• Write
Print “Hello World”
Test python
• Write
Print “Hello World”
Test python
• Write
Print “Hello World”
3+5 or any operations
Test python
• Write
Print “Hello World”
3+6 or any operations
Ways of using python
1-Write directly to the python Shell
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Ways of using python
1-Write directly to the python Shell
2-Write files.py then execute it
FILE  New file  Write your Code
save the file .py ie “TEST.py”
Then run
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Variables and Types
Integers
All Numbers except
fractions
Variables and Types
Integers Float
All Numbers except
fractions
Fractional numbers
Variables and Types
Integers Float Characters
All Numbers except
fractions
Fractional numbers Including ‘A’ :’Z’
Alphabetic ‘@’,’&’
Variables and Types
Integers Float Characters Strings
All Numbers except
fractions
Fractional numbers Including ‘A’ :’Z’
Alphabetic ‘@’,’&’
Like any names
More types
None
It’s a way if saying NULL in python
That evaluates to False
More types
None Boolean
It’s a way if saying NULL in python
That evaluates to False
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
How to name variables!
• Must start with a latter or an underscore
 Name or _Name
• Don’t Start with Numbers
 8name = “Mohamed”
• Names are case sensitive
 Name name NAME are diffirent
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Operators
Practice
Add/Subtract/Multiply/divide/get modules/Quotient/Power
Operations
• Note :-
When dividing two integers
In Python 2.2 or later there’s no difference between ‘/’ and ‘//’
7 //2 = 2 Neglect the fraction part
5/2 = 2 Also Neglect the fraction part !
Then how to solve?
By importing library called division in this way
From __future__ import division
Or
you can use 5/2. = 2.5 that mean divide integer over float
Operators
Practice
Compare between two values
Contents
• Introduction to programming language
• Why python
• Installing python
• Ways of using python
• Variables and Types
• Naming Variables
• Operators
• Strings methods and operations
• Lists methods and operations
• Printing variables and Concatenating
• Casting
• Comments
Strings / Escape sequences
Strings / Escape sequences
Note
Exercise
Make your print Output like that !
My name is “ Mohamed Abdulaal “ , I’m graduated
I Love PROGRAMING / EMBEDDED.
Any Questions ?!
Feed Back

Raspberry using Python Session 1

  • 1.
    Python Programming Language Session 1 MohamedAbdula’al Embedded Software Engineer at EL2 LinkedIn : https://www.linkedin.com/in/mohamed-abdulaal/
  • 2.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 3.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 4.
  • 5.
    Introduction to programminglanguage It’s a set of rules that provides a way of telling the computer what operations to performs as it describe computation
  • 6.
    Introduction to programminglanguage It’s a set of rules that provides a way of telling the computer what operations to performs as it describe computation English language has words, symbols and grammatical rules
  • 7.
    Introduction to programminglanguage It’s a set of rules that provides a way of telling the computer what operations to performs as it describe computation English language has words, symbols and grammatical rules Also programming languages has words and symbols and rule of grammar
  • 8.
    Introduction to programminglanguage It’s a set of rules that provides a way of telling the computer what operations to performs as it describe computation English language has words, symbols and grammatical rules Also programming languages has words and symbols and rule of grammar The grammatical rules are called Syntax!
  • 9.
    Introduction to programminglanguage It’s a set of rules that provides a way of telling the computer what operations to performs as it describe computation English language has words, symbols and grammatical rules Also programming languages has words and symbols and rule of grammar The grammatical rules are called Syntax! Each programming language has it’s own syntax rules.
  • 10.
    Why there areso many languages
  • 11.
    Why there areso many languages • Different tools for different jobs! -Ruby and java script are great job for web sites -C are good in Embedded systems -Objective C used for developing ios applications -C++ used to develop software, videos and games and more
  • 12.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 13.
  • 14.
    Why python?! Open source& free (Thanks Guidi van Rossum)!
  • 15.
    Why python?! Open source& free (Thanks Guidi van Rossum)! Portable- works on every operating systems
  • 16.
    Why python?! Open source& free (Thanks Guidi van Rossum)! Portable- works on every operating systems Easy to learn
  • 17.
    Why python?! Open source& free (Thanks Guidi van Rossum)! Portable- works on every operating systems Easy to learn No compilation necessary. Prototype and run!
  • 18.
    Why python?! Open source& free (Thanks Guidi van Rossum)! Portable- works on every operating systems Easy to learn No compilation necessary. Prototype and run! Powerful libraries
  • 19.
    Why python?! Open source& free (Thanks Guidi van Rossum)! Portable- works on every operating systems Easy to learn No compilation necessary. Prototype and run! Powerful libraries Used for desktop, web applications ,write GUI interfaces,Mobile app development and embedded systep design
  • 20.
  • 21.
  • 22.
  • 23.
    Disadvantages of python It’snot very fast Some find the whitespaces in annoying
  • 24.
  • 25.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 26.
    Installing python • Goto www.python.org
  • 27.
  • 28.
  • 29.
    Test python • Write Print“Hello World” 3+5 or any operations
  • 30.
    Test python • Write Print“Hello World” 3+6 or any operations
  • 31.
    Ways of usingpython 1-Write directly to the python Shell
  • 32.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 33.
    Ways of usingpython 1-Write directly to the python Shell 2-Write files.py then execute it FILE  New file  Write your Code save the file .py ie “TEST.py” Then run
  • 34.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 35.
    Variables and Types Integers AllNumbers except fractions
  • 36.
    Variables and Types IntegersFloat All Numbers except fractions Fractional numbers
  • 37.
    Variables and Types IntegersFloat Characters All Numbers except fractions Fractional numbers Including ‘A’ :’Z’ Alphabetic ‘@’,’&’
  • 38.
    Variables and Types IntegersFloat Characters Strings All Numbers except fractions Fractional numbers Including ‘A’ :’Z’ Alphabetic ‘@’,’&’ Like any names
  • 39.
    More types None It’s away if saying NULL in python That evaluates to False
  • 40.
    More types None Boolean It’sa way if saying NULL in python That evaluates to False
  • 41.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 42.
    How to namevariables! • Must start with a latter or an underscore  Name or _Name • Don’t Start with Numbers  8name = “Mohamed” • Names are case sensitive  Name name NAME are diffirent
  • 43.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 44.
  • 45.
  • 46.
    Operations • Note :- Whendividing two integers In Python 2.2 or later there’s no difference between ‘/’ and ‘//’ 7 //2 = 2 Neglect the fraction part 5/2 = 2 Also Neglect the fraction part ! Then how to solve? By importing library called division in this way From __future__ import division Or you can use 5/2. = 2.5 that mean divide integer over float
  • 47.
  • 48.
  • 49.
    Contents • Introduction toprogramming language • Why python • Installing python • Ways of using python • Variables and Types • Naming Variables • Operators • Strings methods and operations • Lists methods and operations • Printing variables and Concatenating • Casting • Comments
  • 50.
  • 51.
    Strings / Escapesequences Note
  • 52.
    Exercise Make your printOutput like that ! My name is “ Mohamed Abdulaal “ , I’m graduated I Love PROGRAMING / EMBEDDED.
  • 53.
  • 54.