Mindmap
Python
Inhalt der Mindmap
Python
Interactive interface vs writing scripts
- Interactive interface
- Is when You type directly to python one line at a time and it responds
- Example:
- x=2 print x y=x+2 print y
- Example:
- Is when You type directly to python one line at a time and it responds
- Writing scripts
- Is when you enter a sequence of statements (lines) into a file using a text editor
- Python execute the statements in the file
- csev$ cat hello.py print 'Hello world!' csev$ python hello.py Hello world! csev$
- Example:
- Python execute the statements in the file
- Is when you enter a sequence of statements (lines) into a file using a text editor
- Program steps
- Conditional
- Are steps that may be skipped
- Example:
- X=5 If x<10 Print “smaller” If x>20 Print “bigger” Print “finish”
- Example:
- Are steps that may be skipped
- Repeated
- Have interaction variables that change each time through a loop
- Example:
- N=5 While n>0: Print n N=n-1 Print “blastoff”
- Example:
- Have interaction variables that change each time through a loop
- Store
- Are a set of steps to be used over and over as needed several places throughout the program
- Example:
- y=5 print y z=y-3 print z
- Example:
- Are a set of steps to be used over and over as needed several places throughout the program
- Conditional
- Interactive interface
Reserverd words
- Is the python vocabulary
- They have one and only meaning to Python
- Are different from the variables
- The principal reserved words are:
- And, from, not, while, as, elif, global, or, with, assert, else, if, pass, yield, break, except, import, print, class, exec, in, raise, continue, finally, is, return, def, for, lambda, try.
- Example
- When we train a dog, if you say, “I wish more people would walk to improve their overall health”, what most dogs likely hear is, “blah blah blah walk blah blah blah blah”; because walk is it reserved word.
- They have one and only meaning to Python
- Is the python vocabulary
Types of errors
- Syntax error
- Is when you have violated the “grammar” rules of Python.
- Logic errors
- Is when your program has good syntax but there is a mistake in the order of the statements or perhaps a mistake in how the statements relate to one another.
- Example:
- Take a drink from your water bottle, put it in your backpack, walk to the library, and then put the top back on the bottle.
- Example:
- Is when your program has good syntax but there is a mistake in the order of the statements or perhaps a mistake in how the statements relate to one another.
- Semantic errors
- Is when your description of the steps to take is syntactically perfect and in the right order, but there is simply a mistake in the program
- It means that:
- The program is perfectly correct but it does not do what you intended for it to do
- It means that:
- Is when your description of the steps to take is syntactically perfect and in the right order, but there is simply a mistake in the program
- Syntax error
Informationen
- Beschreibung
- Mindmap am Python, erstellt von julianamurciamol am 25/03/2016.
- Erstellt von
- julianamurciamol · Mär 2016
- Aktualisiert
- 26 Mär 2016
- Aufrufe
- 0
- Bewertung