0% found this document useful (0 votes)
102 views

Python Chapter 1vcurso

Uploaded by

Soporte TI
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

Python Chapter 1vcurso

Uploaded by

Soporte TI
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Python Essentials

Intro

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Module 1

• Introduction
• The fundamentals of computer programming
• Setting up your programming environment
• Compilation vs. interpretation
• Introduction to Python

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Module 2
• Data types and the basic methods of formatting, converting, inputting and
outputting data;
• Literals
• Integers, floats, strings, Boolean, octal, hexadecimal
• Operators
• + (addition), - (subtraction), * (multiplication), / (classic division), % (modulus),
** (exponentiation), // (floor)
• Expressions, unary, binary, hierarchy of priorities, exponentiation

• Variables.

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Module 3
 Boolean values
 if-elif-else instructions
 The while and for loops
 Logical and bitwise operations
 >, <, >=, <=, ==, >>, <<
 and, or, not, xor -> & (ampersand), | (bar), ~ (tilde), ^ (caret)

 Lists and arrays


 Sort, operations on list

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Module 4

• Defining and using functions


• built-in, pre-installed, user-defines, lambda
• Different ways of passing arguments
• Parameters, arguments, return
• Name scopes
• Tuples and dictionaries

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
PCEP – Python Certified Entry Programmer

• Module 1
• Module 2
• Module 3
• Module 4
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Module 5
• Python modules: their rationale, function, how to import them in
different ways, and present the content of some standard modules
provided by Python;
• The way in which modules are coupled together to make packages.
• The concept of an exception and Python's implementation of it,
including the try-except instruction, with its applications, and the raise
instruction.
• Strings and their specific methods, together with their similarities and
differences compared to lists.

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Module 6

• The object-oriented approach - foundations


• Classes, methods, objects, and the standard objective features
• Exception handling
• Working with files

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
PCAP – Python Certified Associate Programmer

• Module 1
• Module 2
• Module 3
• Module 4
• Module 5
• Module 6
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Programming
Absolute basics

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Language is a means (and a tool) for expressing and recording

Natural languages vs. programming languages
thoughts:
• Body language: it's possible to express your deepest feelings very
precisely without saying a word.
• Mother tongue: which you use to manifest your will and to think about
reality.
• Computers have their own language, too, called machine language,
which is very rudimentary.
• A complete set of known commands is called an Instruction List (IL)
• Different types of computers can vary depending on the size of your ILs
and the instructions can be completely different on different models.

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
What makes a language?

• AN ALPHABET A set of symbols

• A LEXIS A dictionary

• A SYNTAX A set of rules (formal or informal)

• SEMANTICS A set of rules determining if a certain phrase makes sense

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
What makes a language?

• Computer language is far from a human mother tongue. We need


(both computers and humans) a language or a bridge between the
two different worlds.
• A language in which humans can write their programs and a
language that computers may use to execute the programs.
• Such languages are high-level programming languages. They use
symbols, words and conventions readable to humans. These
languages enable humans to express commands to computers
• A program written in a high-level programming language is called a
source code (in contrast to the machine code executed by
computers) or source file.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Compilation vs. interpretation

There are two different ways


of transforming a program
from a high-level
programming language into
machine language:
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Video: Compilation vs. interpretation (cont.)

• https://www.youtube.com/watch?v=hPYCSu-_LPc&t=343s
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Compilation vs. interpretation
COMPILATION INTERPRETATION

• The execution of the translated code is usually • You can run the code as soon as you complete it -
faster. there are no additional phases of translation;
• Only the user has to have the compiler - the end- • The code is stored using programming language, not
user may use the code without it. the machine one - this means that it can be run on
• The translated code is stored using machine computers using different machine languages; you
ADVANTAGES
language, your own inventions and programming don't compile your code separately for each different
tricks are likely to remain your secret. architecture.

• The compilation itself may be a very time- • Don't expect that interpretation will ramp your code to
consuming process - you may not be able to run high speed - your code will share the computer's power
your code immediately after any amendment; with the interpreter, so it can't be really fast;
• You have to have as many compilers as • Both you and the end user have to have the interpreter
DISADVANTAGES hardware platforms you want your code to be to run your code.
run on.

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
What makes Python special?

• Easy to learn
• Easy to teach
• Easy to use
• Easy to understand
• Easy to obtain, install and deploy

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
When not to use Python

• low-level programming (sometimes called "close to metal"


programming): if you want to implement an extremely effective
driver or graphical engine, you wouldn't use Python;
• applications for mobile devices: although this territory is still
waiting to be conquered by Python, it will most likely happen
someday.

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
There is more than one Python
• Python 2 is an older version of the original
Python. Its development has since been
intentionally stalled, however the updates
are issued on a regular basis, but they are
not intended to modify the language in any
significant way.

• Python 3 is the current version of the language. It's going through its
own evolution path, creating its own standards and habits.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Versions of Python

• Python aka Cpython • Jython

• Cython • PyPy and RPython

In addition to Python 2 and Python 3, there is more than one version

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
How to get Python and how to get to use it

https://www.python.org/downloads/
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Demo – How to use Python IDLE

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

You might also like