Презентация Python онлайн

На нашем сайте вы можете скачать и просмотреть онлайн доклад-презентацию на тему Python абсолютно бесплатно. Урок-презентация на эту тему содержит всего 131 слайд. Все материалы созданы в программе PowerPoint и имеют формат ppt или же pptx. Материалы и темы для презентаций взяты из открытых источников и загружены их авторами, за качество и достоверность информации в них администрация сайта не отвечает, все права принадлежат их создателям. Если вы нашли то, что искали, отблагодарите авторов - поделитесь ссылкой в социальных сетях, а наш сайт добавьте в закладки.



Оцените!
Оцените презентацию от 1 до 5 баллов!
  • Тип файла:
    ppt / pptx (powerpoint)
  • Всего слайдов:
    131 слайд
  • Для класса:
    1,2,3,4,5,6,7,8,9,10,11
  • Размер файла:
    605.76 kB
  • Просмотров:
    89
  • Скачиваний:
    1
  • Автор:
    неизвестен



Слайды и текст к этой презентации:

№1 слайд
Python Vasiliy Kovalev MERA -
Содержание слайда: Python Vasiliy Kovalev MERA - 2019

№2 слайд
About Python
Содержание слайда: About Python

№3 слайд
What is Python? A programming
Содержание слайда: What is Python? A programming language Open Source Free; source code available Download on your own system Written by Guido van Rossum Monty Python’s Flying Circus…

№4 слайд
Features of Python A script
Содержание слайда: Features of Python A script language Interpreted No compile/link stage Write and run Slow compared to C, C++ Elegant design; “tight” Designed for Quick-and-dirty scripts Reusable modules Very large systems Object-oriented Very well-designed But you don’t have to use it

№5 слайд
The Zen of Python Beautiful
Содержание слайда: The Zen of Python Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren’t special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one — and preferably only one — obvious way to do it. Although that way may not be obvious at first unless you’re Dutch. Now is better than never. Although never is often better than 'right now'. If the implementation is hard to explain, it’s a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea — let’s do more of those!

№6 слайд
Part Variables and built-in
Содержание слайда: Part 1: Variables and built-in types

№7 слайд
Basic data types
Содержание слайда: Basic data types

№8 слайд
Useful functions type object
Содержание слайда: Useful functions type(object) – returns type of an object dir(object) – returns a list of attributes for an object

№9 слайд
Useful functions help object
Содержание слайда: Useful functions help(object) – returns description of an object

№10 слайд
Numeric types and literals
Содержание слайда: Numeric types and literals

№11 слайд
Numeric tools
Содержание слайда: Numeric tools

№12 слайд
Содержание слайда:

№13 слайд
Содержание слайда:

№14 слайд
Содержание слайда:

№15 слайд
Содержание слайда:

№16 слайд
Содержание слайда:

№17 слайд
Содержание слайда:

№18 слайд
Содержание слайда:

№19 слайд
Содержание слайда:

№20 слайд
Содержание слайда:

№21 слайд
Содержание слайда:

№22 слайд
Содержание слайда:

№23 слайд
Содержание слайда:

№24 слайд
Содержание слайда:

№25 слайд
Содержание слайда:

№26 слайд
Содержание слайда:

№27 слайд
Содержание слайда:

№28 слайд
Содержание слайда:

№29 слайд
Содержание слайда:

№30 слайд
Содержание слайда:

№31 слайд
Содержание слайда:

№32 слайд
Содержание слайда:

№33 слайд
Содержание слайда:

№34 слайд
Содержание слайда:

№35 слайд
Содержание слайда:

№36 слайд
Содержание слайда:

№37 слайд
Содержание слайда:

№38 слайд
Содержание слайда:

№39 слайд
Содержание слайда:

№40 слайд
Содержание слайда:

№41 слайд
Содержание слайда:

№42 слайд
Содержание слайда:

№43 слайд
Содержание слайда:

№44 слайд
Содержание слайда:

№45 слайд
Содержание слайда:

№46 слайд
Содержание слайда:

№47 слайд
Содержание слайда:

№48 слайд
Содержание слайда:

№49 слайд
Содержание слайда:

№50 слайд
Содержание слайда:

№51 слайд
Содержание слайда:

№52 слайд
Содержание слайда:

№53 слайд
Содержание слайда:

№54 слайд
Содержание слайда:

№55 слайд
Boolean expressions True and
Содержание слайда: Boolean expressions ‘True’ and ‘ False’ are predefined values; actually integers 1 and 0 Value 0 is considered False, all other values True The usual Boolean expression operators: not, and, or

№56 слайд
String Single quotes or
Содержание слайда: String Single quotes or double quotes can be used for string literals Produces exactly the same value Special characters in string literals: \n newline, \t tab, others Triple quotes useful for large chunks of text in program code

№57 слайд
String conversions Convert
Содержание слайда: String conversions Convert data types using functions ‘str’, ‘int’, ‘float’ ‘repr’ is a variant of ‘str’ intended for strict, code-like representation of values ‘str’ usually gives nicer-looking representation Function ‘eval’ interprets a string as a Python expression

№58 слайд
String operations Common
Содержание слайда: String operations Common string operations on page 75 in ‘Learning Python’

№59 слайд
Changing strings. Not! A
Содержание слайда: Changing strings. Not! A string cannot be changed in Python! Immutable Good reasons for this; more later Create new strings from bits and pieces of old

№60 слайд
String methods Strings have a
Содержание слайда: String methods Strings have a set of built-in methods No method ever changes the original string! Several methods produce new strings A list on page 91 in ‘Learning Python’

№61 слайд
List Ordered collection of
Содержание слайда: List Ordered collection of objects; array Heterogenous; may contain mix of objects of any type

№62 слайд
List operations Lists are
Содержание слайда: List operations Lists are mutable; can be changed in-place Lists are dynamic; size may be changed

№63 слайд
List methods, part Lists have
Содержание слайда: List methods, part 1 Lists have a set of built-in methods Some methods change the list in-place

№64 слайд
List methods, part Use the
Содержание слайда: List methods, part 2 Use the built-in 'sort' method: efficient The list is sorted in-place; a new list is not produced!

№65 слайд
Objects, names and references
Содержание слайда: Objects, names and references All values are objects A variable is a name referencing an object An object may have several names referencing it Important when modifying objects in-place! You may have to make proper copies to get the effect you want For immutable objects (numbers, strings), this is never a problem

№66 слайд
Dictionary An unordered
Содержание слайда: Dictionary An unordered collection of key/value pairs Each key maps to a value Also called "mapping", "hash table" or "lookup table"

№67 слайд
Forgetting things garbage
Содержание слайда: Forgetting things: garbage collection What happens to the object when its name is ’del’ed, or reassigned to another object? Don’t worry, be happy! The Python systems detects when an object is ’lost in space’ It keeps track of the number of references to it The object’s memory gets reclaimed; garbage collection A few problematic special cases; cyclical references

№68 слайд
Dictionary methods, part
Содержание слайда: Dictionary methods, part 1

№69 слайд
Dictionary methods, part
Содержание слайда: Dictionary methods, part 2

№70 слайд
Tuple Same as list, except
Содержание слайда: Tuple Same as list, except immutable Once created, can't be changed Some functions return tuples

№71 слайд
String formatting Tuples are
Содержание слайда: String formatting Tuples are used as operands in string formatting when >1 items The length of the tuple must match the number of format codes in the string Lists won't do!

№72 слайд
Part Statements
Содержание слайда: Part 2: Statements

№73 слайд
if statement block structure
Содержание слайда: 'if' statement; block structure The Python feature that one either loves or hates Block structure is determined by indentation Edit a new script file 't2.py' In window 't1.py' do 'File', 'New Window', then 'Save As… Use the 'if' statement:

№74 слайд
Dictionary often better than
Содержание слайда: Dictionary often better than if… elif… Particularly with many hardcoded choices (elif's)… More compact, and more efficient This pattern is very useful

№75 слайд
Built-in types and their
Содержание слайда: Built-in types and their Boolean interpretations

№76 слайд
for statement Repetition of a
Содержание слайда: 'for' statement Repetition of a block of statements Iterate through a sequence (list, tuple, string, iterator)

№77 слайд
Built-in functions range and
Содержание слайда: Built-in functions 'range' and 'xrange' Built-in functions 'range' and 'xrange' useful with 'for' 'range' creates a list Warning: may use lots of memory; inefficient!

№78 слайд
while statement Repetition of
Содержание слайда: 'while' statement Repetition of a block of statements Loop until test becomes false, or 'break'

№79 слайд
Optional else block in loops
Содержание слайда: Optional 'else' block in loops 'else' block executed if no 'break' encountered May often replace success/failure flags Valid in 'for' and 'while' loops

№80 слайд
Error handling try and except
Содержание слайда: Error handling: ’try’ and ’except’ Run-time error normally causes execution to bomb The error message gives type of error Use a ’try’, ’except’ blocks to catch and handle errors

№81 слайд
How to split up long lines
Содержание слайда: How to split up long lines Sometimes a source code line needs splitting up Indentation rule means we do not have free-format!

№82 слайд
Statements not covered in
Содержание слайда: Statements not covered in this course 'finally': used with 'try', 'except' 'raise': causes an exception 'yield': in functions 'global': within functions 'exec': execute strings as code There is no 'goto' statement!

№83 слайд
Part Functions
Содержание слайда: Part 3: Functions

№84 слайд
How to define your own
Содержание слайда: How to define your own function Use the 'def' statement Function body follows; indented! This is a statement like others Can be placed basically anywhere Required: Define the function before calling it

№85 слайд
Function features The value
Содержание слайда: Function features The value of an argument is not checked for type Often very useful; overloading without effort Of course, the function may still bomb if invalid value is given The documentation string is not required (more later) But strongly encouraged! Make a habit of writing one (before writing the function code) A user-defined function has exactly the same status as a built-in function, or a function from another module

№86 слайд
Function arguments fixed
Содержание слайда: Function arguments: fixed Fixed number of arguments Associated by order

№87 слайд
Function arguments variable
Содержание слайда: Function arguments: variable List of any number of arguments Useful when unknown number of arguments needed The argument values collected into a tuple Called 'args', by convention The ’*’ is the magical part

№88 слайд
Function arguments default
Содержание слайда: Function arguments: default values Arguments may have default values When argument not given in a call, default value is used If no default value, and not given when called: bombs Use explicit names to override argument order

№89 слайд
Function arguments keywords
Содержание слайда: Function arguments: keywords Keyword/value arguments The argument values collected into a dictionary Called 'kwargs', by convention The ’**’ is the magical part First attempts to match existing argument names

№90 слайд
Function arguments local
Содержание слайда: Function arguments: local variables Arguments become local variables Immutable values are copied, in effect Mutable values may still be changed: be careful Variables created within 'def' block are local Forgotten on return

№91 слайд
Function without return value
Содержание слайда: Function without 'return': value None A function does not have to use the 'return' statement If not, then same as a 'procedure' in other languages Actually returns a value anyway: 'None' A 'return' without value is OK: returns 'None' 'None' is a special value meaning 'nothing' Useful in many contexts Particularly in object-oriented programming (more later)

№92 слайд
The math module functions and
Содержание слайда: The 'math' module: functions and constants A peek at modules Math functions available in a separate module

№93 слайд
Functions are objects names
Содержание слайда: Functions are objects; names are references A function is just another kind of object Nothing magical about their names; can be changed

№94 слайд
Built-in function map
Содержание слайда: Built-in function 'map' Built-in function that works on a list 'map' takes a function and a list The function must take only one argument, and return one value The function is applied to each value of the list The resulting values are returned in a list

№95 слайд
Built-in function reduce
Содержание слайда: Built-in function 'reduce'

№96 слайд
Built-in function filter
Содержание слайда: Built-in function 'filter'

№97 слайд
Files reading A file object
Содержание слайда: Files: reading A file object is created by the built-in function 'open' The file object has a set of methods The 'read' methods get data sequentially from the file 'read': Get the entire file (or N bytes) and return as a single string 'readline': Read a line (up to and including newline) 'readlines': Read all lines and return as a list of strings

№98 слайд
Files writing The write
Содержание слайда: Files: writing The 'write' method simply outputs the given string The string does not have to be ASCII; binary contents allowed

№99 слайд
Part Modules
Содержание слайда: Part 4: Modules

№100 слайд
Example Reverse complement NT
Содержание слайда: Example: Reverse complement NT sequence Given a nucleotide sequence, produce reverse complement Use available features

№101 слайд
Make a module of the code How
Содержание слайда: Make a module of the code How to make the code even more reusable? Step 2: Make a module out of it Is actually already a module! Let’s simply rename it to ’ntseq.py’

№102 слайд
How to use the module import
Содержание слайда: How to use the module: ’import’ statement The ’import’ statement makes a module available The module name (not the file name) is imported: skip the ’.py’ Access module features through the ’dot’ notation

№103 слайд
Module self-test code the
Содержание слайда: Module self-test code: the ’__name__’ trick The ’import’ statement executes all code in the module file How to ’hide’ self-test code? Use the predefined variable ’__name__’: If executed as the main program: value ’__main__’ If executed as a module: some other value

№104 слайд
Now, the import statement
Содержание слайда: Now, the ’import’ statement behaves

№105 слайд
Modules are easy, fun, and
Содержание слайда: Modules are easy, fun, and powerful The module feature is the basis for Python's ability to scale to really large software systems Easy to create: every Python source code file is a module! Features to make a module elegant: Doc strings '__name__' trick Namespace concept Be sure to browse the standard library modules! You will find extremely useful stuff there You will learn good coding habits Packages are directories of several associated modules Not covered in this course. A few minor interesting points

№106 слайд
Namespaces A namespace is a
Содержание слайда: Namespaces A namespace is a bag of names A module is a namespace Use the built-in function ’dir’ to list the names in a namespace ’import’ statement modifies the namespace

№107 слайд
Avoiding clutter in your
Содержание слайда: Avoiding clutter in your namespace Using ’from module import *’ can create clutter Fine-tuning of import; bring in only selected things Rename things from a module Avoid name collisions Make it clearer

№108 слайд
Doc strings doc We have
Содержание слайда: Doc strings: ’__doc__’ We have mentioned documentation strings before The first string in a module The first string after a ’def’ statement Accessed through variable ’__doc__’ Feature to facilitate creation of documentation Used by tools to produce documentation, such as ’pydoc’ See ’Module Docs’ in ’Start’ > ’Programs’ > ’Python 2.3’

№109 слайд
Part Object-oriented
Содержание слайда: Part 5: Object-oriented programming, classes

№110 слайд
Classes vs. objects instances
Содержание слайда: Classes vs. objects (instances) A class is like a Prototype Blue-print ("ritning") An object creator A class defines potential objects What their structure will be What they will be able to do Objects are instances of a class An object is a container of data: attributes An object has associated functions: methods

№111 слайд
A class example Geometrical
Содержание слайда: A class example: Geometrical shapes Let's define classes for geometrical shapes With data; position, etc With functions: compute area, etc

№112 слайд
Instances of classes Let s
Содержание слайда: Instances of classes Let's create some instances of the Circle class Look at attribute 'radius' Use the method 'area'

№113 слайд
Changing an instance
Содержание слайда: Changing an instance: references Variables may reference the same object Changing an attribute changes the object, not the reference

№114 слайд
Changing an instance
Содержание слайда: Changing an instance: attribute add/delete An attribute can be added! And deleted!

№115 слайд
Equality between objects Two
Содержание слайда: Equality between objects Two kinds of equality: Are the two objects similar in value? Are the two references actually pointing to the same object?

№116 слайд
Special methods in classes
Содержание слайда: Special methods in classes Special methods '__xxx__' in classes Define custom-made behaviour See page 327 in 'Learning Python'

№117 слайд
Using the special methods,
Содержание слайда: Using the special methods, part 1 Special method definitions are detected by Python Built-in functions use them; see documentation

№118 слайд
Using the special methods,
Содержание слайда: Using the special methods, part 2 Defining special methods may clarify code tremendously But: Stay reasonable 'natural'!

№119 слайд
Inheritance Class hierarchies
Содержание слайда: Inheritance: Class hierarchies Let's define a general 'Shape' class 'Circle' is a special case of 'Shape' 'Blob' is also a special case of 'Shape' Notice: redefinition of 'is_round' in 'Blob'

№120 слайд
Instances of classes using
Содержание слайда: Instances of classes using inheritance Which method is called by which instance? Polymorphism Selection of method depends on actual class of the instance Extremely powerful, if properly designed class hierarchy

№121 слайд
Part Standard library modules
Содержание слайда: Part 6: Standard library modules

№122 слайд
Module re , part Define a
Содержание слайда: Module 're', part 1 Define a pattern The pattern syntax is very much like Perl or grep Apply it to a string Process the results

№123 слайд
Module sys , part sys.argv
Содержание слайда: Module 'sys', part 1 sys.argv List of command-line arguments; sys.argv[0] is script name sys.path List of directory names, where modules are searched for sys.platform String to identify type of computer system

№124 слайд
Module sys , part sys.stdout,
Содержание слайда: Module 'sys', part 2 sys.stdout, sys.stdin, sys.stderr Predefined file objects for input/output 'print' stuff goes to 'sys.stdout' May be set to other files sys.exit(n) Force exit from Python execution 'n' is an integer error code, normally 0

№125 слайд
Module os , part os.getcwd
Содержание слайда: Module 'os', part 1 os.getcwd() Returns the current directory

№126 слайд
Module os , part os.chdir
Содержание слайда: Module 'os', part 2 os.chdir(path) Changes the current working directory to 'path' os.listdir(path) Return a list of the contents of the directory 'path' os.mkdir(path) Create the directory 'path' os.rmdir(path) Remove the directory 'path' os.remove(path) Remove the file named 'path'

№127 слайд
Module os , part os.system
Содержание слайда: Module 'os', part 3 os.system(command) Execute the shell command (string) in a subprocess Return the error code as integer os.popen(command, mode='r') Run the shell command (string) Open a pipe to the command, return as a file object Mode is either read, or write; not both os.popen2, os.popen3, os.popen4 Variants of os.popen, with different file objects os.getpid() Return the process ID as integer

№128 слайд
Module os.path , part
Содержание слайда: Module 'os.path', part 1 os.path.abspath(path) Returns the absolute path for the given relative 'path'

№129 слайд
Module os.path , part
Содержание слайда: Module 'os.path', part 2 os.path.join(path, path, …) Joint together the path parts intelligently into a valid path name

№130 слайд
Module os.path , part
Содержание слайда: Module 'os.path', part 3 os.path.isfile(path) Is 'path' the name of a file? os.path.isdir(path) Is 'path' the name of a directory?

№131 слайд
Some other useful modules
Содержание слайда: Some other useful modules

Скачать все slide презентации Python одним архивом: