SlideShare a Scribd company logo
1 of 32
Download to read offline
PYTHON FROM NOVICE TO 
NINJA. 
A CONVERT SESSION BY @ALSAYEDGAMAL
WARNING: BEGINNERS ONLY 
SESSION 
• Works also as a quick 
start guide for other 
language developers. 
• No offence Java guys :)
AGENDA 
• Motivation. 
• Python essentials. 
• Some basic examples. 
• What to hack ?
MOTIVATION 
WHY PYTHON ?
OPEN SOURCE 
(FREEDOM)
CROSS PLATFORM 
WRITE ONCE, RUN EVERYWHERE.
SYSTEM.OUT.PRINT(“HELLO,WORLD”); 
IT TAKES 1 LINE TO YOUR “HELLO, WORLD” 
EASY TO LEARN 
IT TAKES > 10 SECONDS TO WRITE YOUR 
HELLO, WORLD.
FROM 29TH TO 7TH IN < 8 YEARS* 
IT’S 8TH SINCE 2012 
*TOIBE.COM | TIOBE PROGRAMMING COMMUNITY INDEX FOR NOVEMBER 2014
PYTHON ESSENTIALS 
• Scripting nature. 
• Basic data types. 
• Operators. 
• Flow control. 
• Functions are fun. 
• Modules. 
• OOP.
EXPRESSION IN PYTHON. 
OPERATORS 
variable = 3 + 2 #EXPRESSION 
OPERANDS 
+ * = / % 
[] () > = 
& != | 
Variables 
x,name, 
__len__ 
Data 
5, “hello”, 
[1,2,3]
TYPES IN PYTHON 
#ASSIGNMENT 
! 
#CHECK FOO’S TYPE 
! 
#ANOTHER ASSIGNMENT 
! 
#FOO’S TYPE CHANGED 
variable = 10 
type(variable) 
variable = “ten” 
type(variable) 
Dynamic 
Implicit 
x = 10 + “10” #ERROR
TYPES IN PYTHON Strings 
line = “Hello” 
multi = “”” I use this to write multiline 
strings like html tags””” 
raw = r’I’ll not replace n or t’ #used in regex 
print(line[0]) #will print H try -3 
template = "%d developers founded %s” % (3, ‘GDG Mansoura’) 
#3 developers founded GDG Mansoura 
‘{0}, {1}, {2}’.format(‘A’, ‘B’, ‘C’) #A, B, C 
unicode_str = u’A unicode u018e string xf1'
TYPES IN PYTHON Boolean 
1. It’s True not true 
2. It’s False not false
TYPES IN PYTHON Data structures 
List 
names = [‘Ahmed’, ‘Sayed’, ‘AbdulHameed’] 
first_name = names[0] 
names[1] = “AlSayed” #names = [‘Ahmed’, ‘AlSayed’, ‘AbdulHameed’] 
Tuple 
family = (“AlSayed”, ”Reem”) 
family[1] = “Some one else” 
TypeError: 'tuple' object does not support item assignment 
x = 5 
y = 6 
x, y = y, x
TYPES IN PYTHON Data structures 
Dictionary 
phonebook = {‘name’:”Ahmed Gamal”, ‘age’ : 28, 
‘telephone’: ‘0123456789’,‘email’: ‘ahmed@example.com’} 
Traversing Dictionary 
for key in phonebook.keys(): print key 
for val in phonebook.values(): print val
PYTHON BLOCKS 
if condition: 
If block 
elif condition: 
else If block 
else: 
else block 
Branching 
Where is a fixed indentation spaces or tabs
PYTHON BLOCKS 
for item in xrange(10): 
for block 
else: 
@ normal end 
Loop 
while true: 
loop on this 
else: 
@ normal end 
Normal end means no break 
For is used basically for traversing iterable types (lists for example) 
xrange is generating an iterable object
PYTHON BLOCKS Loop 
found_obj = None 
for obj in objects: 
if obj.key == search_key: 
found_obj = obj 
break 
else: 
print (‘No object found.’)
PYTHON BLOCKS 
class Car(Vehicle): 
#constructor 
def __init__(self, arg1): 
pass 
Class Definition
PYTHON BLOCKS 
def foo(x,y): 
function body 
Functions 
def foo(x,y=‘default’): 
function body 
def foo(x,y=‘default’): 
function body 
def foo(x,y): 
return exprsn 
def foo(x,y=‘default’): 
function body 
def foo(x,y=‘default’): 
function body
GETTING YOUR HANDS DIRTY 
TIME TO EXPLAIN IN CODE.
BEFORE WE START 
• If you are linux or unix based you are good to go. 
• Else If you are on windows (I hope not) download 
and install 
• sublime text editor 
• python runtime 
• Our code will be perfect for Python 2.x and may be 
3.x.
SORTED?
MEDIA.PY 
P1: Tawfik Okasha 
P2: Amr Adib
SCRIPT HIGHLIGHTS. 
• Basic expression (variable assignment). 
• User input and output. 
• Function definition / passing function as variable. 
• List data-type. 
• Basic sorting.
MODULES AND PACKAGES 
• from foo import bar 
• from foor import * # please, don’t use it often 
• Packages are directory with __init__.py file 
• import this #Zen of python
NEXT: SHAPING YOUR EXPERIENCE 
SYSTEM ADMIN, WEB, DESKTOP, NETWORK, 
GAME DEVELOPMENT,…
QUESTIONS?
THANKS
RESOURCES 
• Google Education (Python Class)| 
https://developers.google.com/edu/python/ 
• Python Docs | https://docs.python.org 
• www.tiobe.com/index.php/content/paperinfo/ 
tpci/index.html

More Related Content

What's hot

Php 101 by David Menendez
Php 101 by David MenendezPhp 101 by David Menendez
Php 101 by David Menendezdm09f
 
Elegant Solutions For Everyday Python Problems - Nina Zakharenko
Elegant Solutions For Everyday Python Problems - Nina ZakharenkoElegant Solutions For Everyday Python Problems - Nina Zakharenko
Elegant Solutions For Everyday Python Problems - Nina ZakharenkoNina Zakharenko
 
PHP object calisthenics
PHP object calisthenicsPHP object calisthenics
PHP object calisthenicsGiorgio Cefaro
 
Total World Domination with i18n (es)
Total World Domination with i18n (es)Total World Domination with i18n (es)
Total World Domination with i18n (es)Zé Fontainhas
 
アプリを弄ってみる #1 #antama_ws
アプリを弄ってみる #1 #antama_wsアプリを弄ってみる #1 #antama_ws
アプリを弄ってみる #1 #antama_wsTakahiro Yoshimura
 
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & ReasonType Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & ReasonNikolaus Graf
 
Perl6 operators and metaoperators
Perl6   operators and metaoperatorsPerl6   operators and metaoperators
Perl6 operators and metaoperatorsSimon Proctor
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trialbrian d foy
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaWhat is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaEdureka!
 
Advanced modulinos
Advanced modulinosAdvanced modulinos
Advanced modulinosbrian d foy
 
Python: with-statement, generators
Python: with-statement, generatorsPython: with-statement, generators
Python: with-statement, generatorsMario Konschake
 

What's hot (15)

Php 101 by David Menendez
Php 101 by David MenendezPhp 101 by David Menendez
Php 101 by David Menendez
 
Table through php
Table through phpTable through php
Table through php
 
Elegant Solutions For Everyday Python Problems - Nina Zakharenko
Elegant Solutions For Everyday Python Problems - Nina ZakharenkoElegant Solutions For Everyday Python Problems - Nina Zakharenko
Elegant Solutions For Everyday Python Problems - Nina Zakharenko
 
Dades i operadors
Dades i operadorsDades i operadors
Dades i operadors
 
PHP object calisthenics
PHP object calisthenicsPHP object calisthenics
PHP object calisthenics
 
Total World Domination with i18n (es)
Total World Domination with i18n (es)Total World Domination with i18n (es)
Total World Domination with i18n (es)
 
アプリを弄ってみる #1 #antama_ws
アプリを弄ってみる #1 #antama_wsアプリを弄ってみる #1 #antama_ws
アプリを弄ってみる #1 #antama_ws
 
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & ReasonType Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
 
Perl6 operators and metaoperators
Perl6   operators and metaoperatorsPerl6   operators and metaoperators
Perl6 operators and metaoperators
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trial
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaWhat is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | Edureka
 
Migrare da symfony 1 a Symfony2
 Migrare da symfony 1 a Symfony2  Migrare da symfony 1 a Symfony2
Migrare da symfony 1 a Symfony2
 
Php modul-2
Php modul-2Php modul-2
Php modul-2
 
Advanced modulinos
Advanced modulinosAdvanced modulinos
Advanced modulinos
 
Python: with-statement, generators
Python: with-statement, generatorsPython: with-statement, generators
Python: with-statement, generators
 

Similar to Python Novice to Ninja

Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
 
An Intro to Python in 30 minutes
An Intro to Python in 30 minutesAn Intro to Python in 30 minutes
An Intro to Python in 30 minutesSumit Raj
 
Python for scientific computing
Python for scientific computingPython for scientific computing
Python for scientific computingGo Asgard
 
Python: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopersPython: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopersGlenn De Backer
 
Lesson1 python an introduction
Lesson1 python an introductionLesson1 python an introduction
Lesson1 python an introductionArulalan T
 
Python.pptx
Python.pptxPython.pptx
Python.pptxAshaS74
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonAhmed Salama
 
Hands on Session on Python
Hands on Session on PythonHands on Session on Python
Hands on Session on PythonSumit Raj
 
From 0 to mine sweeper in pyside
From 0 to mine sweeper in pysideFrom 0 to mine sweeper in pyside
From 0 to mine sweeper in pysideDinesh Manajipet
 
Python introduction 2
Python introduction 2Python introduction 2
Python introduction 2Ahmad Hussein
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandAngela Byron
 
The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181Mahmoud Samir Fayed
 
Fast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBMongoDB
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methodsPranavSB
 

Similar to Python Novice to Ninja (20)

Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
An Intro to Python in 30 minutes
An Intro to Python in 30 minutesAn Intro to Python in 30 minutes
An Intro to Python in 30 minutes
 
Python for scientific computing
Python for scientific computingPython for scientific computing
Python for scientific computing
 
Python: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopersPython: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopers
 
Lesson1 python an introduction
Lesson1 python an introductionLesson1 python an introduction
Lesson1 python an introduction
 
Python 101
Python 101Python 101
Python 101
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Hands on Session on Python
Hands on Session on PythonHands on Session on Python
Hands on Session on Python
 
Python for dummies
Python for dummiesPython for dummies
Python for dummies
 
From 0 to mine sweeper in pyside
From 0 to mine sweeper in pysideFrom 0 to mine sweeper in pyside
From 0 to mine sweeper in pyside
 
Python introduction 2
Python introduction 2Python introduction 2
Python introduction 2
 
Python basic
Python basicPython basic
Python basic
 
обзор Python
обзор Pythonобзор Python
обзор Python
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the island
 
Charming python
Charming pythonCharming python
Charming python
 
The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181The Ring programming language version 1.5.2 book - Part 6 of 181
The Ring programming language version 1.5.2 book - Part 6 of 181
 
Fast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDB
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
 

More from Al Sayed Gamal

More from Al Sayed Gamal (20)

9 patterns of microservices
9 patterns of microservices9 patterns of microservices
9 patterns of microservices
 
Elixir introduction
Elixir introductionElixir introduction
Elixir introduction
 
Racist syndrome (composition over inheritance)
Racist syndrome (composition over inheritance)Racist syndrome (composition over inheritance)
Racist syndrome (composition over inheritance)
 
Ionic Hybrid Mobile Application
Ionic Hybrid Mobile ApplicationIonic Hybrid Mobile Application
Ionic Hybrid Mobile Application
 
Rails course day 8
Rails course day 8Rails course day 8
Rails course day 8
 
Rails course day 7
Rails course day 7Rails course day 7
Rails course day 7
 
Rails course day 6
Rails course day 6Rails course day 6
Rails course day 6
 
Rails course day 5
Rails course day 5Rails course day 5
Rails course day 5
 
Rails course day 4
Rails course day 4Rails course day 4
Rails course day 4
 
Rails course day 3
Rails course day 3Rails course day 3
Rails course day 3
 
Rails course day 2
Rails course  day 2Rails course  day 2
Rails course day 2
 
Rails01
Rails01Rails01
Rails01
 
OpenStack Murano Application Catalog
OpenStack Murano Application CatalogOpenStack Murano Application Catalog
OpenStack Murano Application Catalog
 
Failfast
FailfastFailfast
Failfast
 
Git workshop
Git workshopGit workshop
Git workshop
 
Web development Hackathon
Web development HackathonWeb development Hackathon
Web development Hackathon
 
Python novice to ninja
Python novice to ninjaPython novice to ninja
Python novice to ninja
 
Python 45 minutes hangout #3
Python 45 minutes hangout #3Python 45 minutes hangout #3
Python 45 minutes hangout #3
 
Python 45 minutes Hangouts #4
Python 45 minutes Hangouts  #4Python 45 minutes Hangouts  #4
Python 45 minutes Hangouts #4
 
Python45 2
Python45 2Python45 2
Python45 2
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Python Novice to Ninja

  • 1.
  • 2. PYTHON FROM NOVICE TO NINJA. A CONVERT SESSION BY @ALSAYEDGAMAL
  • 3. WARNING: BEGINNERS ONLY SESSION • Works also as a quick start guide for other language developers. • No offence Java guys :)
  • 4. AGENDA • Motivation. • Python essentials. • Some basic examples. • What to hack ?
  • 7. CROSS PLATFORM WRITE ONCE, RUN EVERYWHERE.
  • 8. SYSTEM.OUT.PRINT(“HELLO,WORLD”); IT TAKES 1 LINE TO YOUR “HELLO, WORLD” EASY TO LEARN IT TAKES > 10 SECONDS TO WRITE YOUR HELLO, WORLD.
  • 9. FROM 29TH TO 7TH IN < 8 YEARS* IT’S 8TH SINCE 2012 *TOIBE.COM | TIOBE PROGRAMMING COMMUNITY INDEX FOR NOVEMBER 2014
  • 10. PYTHON ESSENTIALS • Scripting nature. • Basic data types. • Operators. • Flow control. • Functions are fun. • Modules. • OOP.
  • 11. EXPRESSION IN PYTHON. OPERATORS variable = 3 + 2 #EXPRESSION OPERANDS + * = / % [] () > = & != | Variables x,name, __len__ Data 5, “hello”, [1,2,3]
  • 12. TYPES IN PYTHON #ASSIGNMENT ! #CHECK FOO’S TYPE ! #ANOTHER ASSIGNMENT ! #FOO’S TYPE CHANGED variable = 10 type(variable) variable = “ten” type(variable) Dynamic Implicit x = 10 + “10” #ERROR
  • 13. TYPES IN PYTHON Strings line = “Hello” multi = “”” I use this to write multiline strings like html tags””” raw = r’I’ll not replace n or t’ #used in regex print(line[0]) #will print H try -3 template = "%d developers founded %s” % (3, ‘GDG Mansoura’) #3 developers founded GDG Mansoura ‘{0}, {1}, {2}’.format(‘A’, ‘B’, ‘C’) #A, B, C unicode_str = u’A unicode u018e string xf1'
  • 14. TYPES IN PYTHON Boolean 1. It’s True not true 2. It’s False not false
  • 15. TYPES IN PYTHON Data structures List names = [‘Ahmed’, ‘Sayed’, ‘AbdulHameed’] first_name = names[0] names[1] = “AlSayed” #names = [‘Ahmed’, ‘AlSayed’, ‘AbdulHameed’] Tuple family = (“AlSayed”, ”Reem”) family[1] = “Some one else” TypeError: 'tuple' object does not support item assignment x = 5 y = 6 x, y = y, x
  • 16. TYPES IN PYTHON Data structures Dictionary phonebook = {‘name’:”Ahmed Gamal”, ‘age’ : 28, ‘telephone’: ‘0123456789’,‘email’: ‘ahmed@example.com’} Traversing Dictionary for key in phonebook.keys(): print key for val in phonebook.values(): print val
  • 17. PYTHON BLOCKS if condition: If block elif condition: else If block else: else block Branching Where is a fixed indentation spaces or tabs
  • 18. PYTHON BLOCKS for item in xrange(10): for block else: @ normal end Loop while true: loop on this else: @ normal end Normal end means no break For is used basically for traversing iterable types (lists for example) xrange is generating an iterable object
  • 19. PYTHON BLOCKS Loop found_obj = None for obj in objects: if obj.key == search_key: found_obj = obj break else: print (‘No object found.’)
  • 20. PYTHON BLOCKS class Car(Vehicle): #constructor def __init__(self, arg1): pass Class Definition
  • 21. PYTHON BLOCKS def foo(x,y): function body Functions def foo(x,y=‘default’): function body def foo(x,y=‘default’): function body def foo(x,y): return exprsn def foo(x,y=‘default’): function body def foo(x,y=‘default’): function body
  • 22. GETTING YOUR HANDS DIRTY TIME TO EXPLAIN IN CODE.
  • 23. BEFORE WE START • If you are linux or unix based you are good to go. • Else If you are on windows (I hope not) download and install • sublime text editor • python runtime • Our code will be perfect for Python 2.x and may be 3.x.
  • 25. MEDIA.PY P1: Tawfik Okasha P2: Amr Adib
  • 26. SCRIPT HIGHLIGHTS. • Basic expression (variable assignment). • User input and output. • Function definition / passing function as variable. • List data-type. • Basic sorting.
  • 27. MODULES AND PACKAGES • from foo import bar • from foor import * # please, don’t use it often • Packages are directory with __init__.py file • import this #Zen of python
  • 28. NEXT: SHAPING YOUR EXPERIENCE SYSTEM ADMIN, WEB, DESKTOP, NETWORK, GAME DEVELOPMENT,…
  • 29.
  • 32. RESOURCES • Google Education (Python Class)| https://developers.google.com/edu/python/ • Python Docs | https://docs.python.org • www.tiobe.com/index.php/content/paperinfo/ tpci/index.html