Опубликован: 12.07.2013 | Доступ: свободный | Студентов: 985 / 36 | Длительность: 37:41:00
Дополнительный материал 5:

Glossary

< Дополнительный материал 4 || Дополнительный материал 5: 12

key-value pairs - In dictionary data types, keys are values that are used to access the values in a dictionary, much like a list's index is used to access the values in a list. Unlike lists, dictionary keys can be of any data type, not just integers.

keys - In dictionaries, keys are the indexes used to

keys - In cryptography, a specific value (usuaully a number) that determines how a cipher encrypts a message. To decrypt the message, you must know both the cipher and the key value that was used.

list - The main container data type, lists can contain several other values, including other lists. Values in lists are accessed by an integer index between square brackets. For example, if spam is assigned the list ['a', 'b', 'c'], then spam[2] would evaluate to 'c'.

list concatenation - Combining the contents of one list to the end of another with the + operator. For example, [1, 2, 3] + ['a', 'b', 'c'] evaluates to [1, 2, 3, 'a', 'b', 'c'].

local scope - The scope of variables inside a single functions. Python code inside a function can read the value of variables in the global scope, but any changes or new variables made will only exist while execution is inside that function call.

loop - A block of code inside a loop (after a for or while statement) will repeatedly execute until some condition is met.

loop unrolling - Replacing code inside a loop with multiple copies of that code. For example, instead of for i in range(10): print 'Hello', you could unroll that loop by having ten lines of print 'Hello'

machine code - The language that the computer's CPU understands. Machine code instructions are series of ones and zeros, and is generally unreadable by humans. Interpreters (such as the Python interpreter) translate a higher-level language into machine code.

methods - Functions that are associated with values of a data type. For example, the string method upper() would be invoked on a string like this: 'Hello'.upper()

module - A separate Python program that can be included in your programs so that you can make use of the functions in the module.

modulus operator - The "remainder" operator that is represented with a % percent sign. For example, while 20 / 7 is 6 with a remainder of 2, 20 % 7 would evaluate to 2.

mutable sequence - A container data type that is ordered and can have values added or removed from it. Lists are a mutable sequence data type in Python.

negative numbers - All numbers less than 0. Negative numbers have a minus sign in front of them to differentiate them from positive numbers, for example, -42 or -10.

nested loops - Loops that exist inside other loops.

None - The only value in the NoneType data type. "None" is often used to represent the lack of a value.

operating system - A large program that runs other software programs (called applications) the same way on different hardware. Windows, Mac OS, and Linux are examples of operating systems.

operators - Operators connect values in expressions. Operators include +, -, *, /, and, and or

ordinal - In ASCII, the number that represents an ASCII character. For example, the ASCII character "A" has the ordinal 65.

origin - In cartesian coordinate systems, the point at the coordinates 0, 0.

OS - see, operating system

output - The text that a program produces for the user. For example, print statements produce output.

overwrite - To replace a value stored in a variable with a new value.

parameter - A variable that is specified to have a value passed in a function call. For example, the statement def spam(eggs, cheese) defines a function with two parameters named eggs and cheese.

pie chart - A circular chart that shows percentage portions as portions of the entire circle.

plaintext - The decrypted, human-readable form of a message.

player - A person who plays the computer game.

positive numbers - All numbers equal to or greater than 0.

pound sign - The # sign. Pound signs are used to begin comments.

print statement - The print keyword followed by a value that is to be displayed on the screen.

program - A collection of instructions that can process input and produce output when run by computer.

programmer - A person who writes computer programs.

reference - Rather than containing the values themselves, list variables actually contain references to lists. For example, spam = [1, 2, 3] assigns spam a reference to the list. cheese = spam would copy the reference to the list spam refers to. Any changes made to the cheese or spam variable would be reflected in the other variable.

return statement - The return followed by a single value, which is what the call to the function the return statement is in will evaluate to.

return value - The value that a call to the function will evaluate to. You can specify what the return value is with the return keyword followed by the value. Functions with no return statement will return the value None.

runtime error - An error that occurs when the program is running. A runtime error will cause the program to crash and stop executing.

scope - See, local scope and global scope.

sequence - A sequence data type is an ordered container data type, and have a "first" or "last" item. The sequence data types in Python are lists, tuples, and strings. Dictionaries are not sequences, they are unordered.

semantic error - An error that will not cause the program to crash immediately, but will cause the program to run in an unintended way. A semantic error may cause a runtime error and crash later on in the program.

shell - see, interactive shell

simple substitution ciphers - A cipher where each letter is replaced by one and only one other letter.

slice - A subset of values in a list. These are accessed using the : colon character in between the square brackets. For example, if spam has the value ['a', 'b', 'c', 'd', 'e', 'f'], then the slice spam[2:4] has the value ['c', 'd']. Similar to a substring.

software - see, program

source code - The text that you type in to write a program.

statement - A command or line of Python code that does not evaluate to a value.

stepping - Executing one line of code at a time in a debugger, which can make it easier to find out when problems in the code occur.

string concatenation - Combining two strings together with the + operator to form a new string. For example, 'Hello ' + 'World!' evaluates to the string 'Hello World!'

string formatting - Another term for string interpolation.

string interpolation - Using conversion specifiers in a string as place holders for other values. Using string interpolation is a more convenient alternative to string concatenation. For example, 'Hello, %s. Are you going to %s on %s?' % (name, activity, day) evaluates to the string 'Hello, Albert. Are you going to program on Thursday?', if the variables have those corresponding values.

string - A value made up of text. Strings are typed in with a single quote ' or double " on either side. For example, 'Hello'

substring - A subset of a string value. For example, if spam is the string 'Hello', then the substring spam[1:4] is 'ell'. Similar to a list slice.

symbols - In cryptography, the individual characters that are encrypted.

syntax - The rules for how code is ordered in a programming language, much like grammar is made up of the rules for understandable English sentences.

syntax error - An error that occurs when the Python interpreter does not understand the code because the code is incomplete or in the wrong order. A program with a syntax error will not run.

terminate - When a program ends. "Exit" means the same thing.

tracing - To follow through the lines of code in a program in the order that they would execute.

truth tables - Tables showing every possible combination of

tuple - A container data type similar to a list. Tuples are immutable sequence data types, meaning that they cannot have values added or removed from them. For example, (1, 2, 'cats', 'hello') is a tuple of four values.

type - see, data types

unordered - In container data types, unordered data types do not have a "first" or "last" value contained inside them, they simply contain values. Dictionaries are the only unordered data type in Python. Lists, tuples, and strings are ordered data types. See also, sequence.

user - The person using the program.

value - A specific instance of a data type. 42 is a value of the integer type. 'Hello' is a value of the string type.

variables - A container that can store a value. List variables contain references to lists.

while loop statement - The while keyword, followed by a condition, ending with a : colon character. The while statement marks the beginning of a while loop.

X-axis - In cartesian coordinate systems, the horizontal (left-right) coordinate axis.

Y-axis - In cartesian coordinate systems, the vertical (up-down) coordinate axis.

< Дополнительный материал 4 || Дополнительный материал 5: 12