• Home   /  
  • Archive by category "1"

Pseudo Code Assignment Statement Python

For assignment of letters to disk file systems, see Drive letter assignment.

In computer programming, an assignment statement sets and/or re-sets the value stored in the storage location(s) denoted by a variablename; in other words, it copies a value into the variable. In most imperativeprogramming languages, the assignment statement (or expression) is a fundamental construct.

Today, the most commonly used notation for this basic operation has come to be (originally Superplan 1949–51, popularized by Fortran 1957 and C) followed by [1] (originally ALGOL 1958, popularised by Pascal),[2] although there are many other notations in use. In some languages the symbol used is regarded as an operator (meaning that the assignment has a value) while others define the assignment as a statement (meaning that it cannot be used in an expression).

Assignments typically allow a variable to hold different values at different times during its life-span and scope. However, some languages (primarily strictly functional) do not allow that kind of "destructive" reassignment, as it might imply changes of non-local state. The purpose is to enforce referential transparency, i.e. functions that do not depend on the state of some variable(s), but produce the same results for a given set of parametric inputs at any point in time. Modern programs in other languages also often use similar strategies, although less strict, and only in certain parts, in order to reduce complexity, normally in conjunction with complementing methodologies such as data structuring, structured programming and object orientation.


An assignment operation is a process in imperative programming in which different values are associated with a particular variable name as time passes.[1] The program, in such model, operates by changing its state using successive assignment statements.[2][3] Primitives of imperative programming languages rely on assignment to do iteration.[4] At the lowest level, assignment is implemented using machine operations such as or .[2][4]

Variables are containers for values. It is possible to put a value into a variable and later replace it with a new one. An assignment operation modifies the current state of the executing program.[3] Consequently, assignment is dependent on the concept of variables. In an assignment:

  • The is evaluated in the current state of the program.
  • The is assigned the computed value, replacing the prior value of that variable.

Example: Assuming that is a numeric variable, the assignment means that the content of the variable is doubled after the execution of the statement.

An example segment of C code:


In this sample, the variable is first declared as an int, and is then assigned the value of 10. Notice that the declaration and assignment occur in the same statement. In the second line, is declared without an assignment. In the third line, is reassigned the value of 23. Finally, is assigned the value of 32.4.

For an assignment operation, it is necessary that the value of the is well-defined (it is a valid rvalue) and that the represents a modifiable entity (it is a valid modifiable (non-const) lvalue). In some languages, typically dynamic ones, it is not necessary to declare a variable prior to assigning it a value.

Single assignment[edit]

See also: Static single assignment form

Any assignment that changes an existing value (e.g. ) is disallowed in purely functional languages.[4] In functional programming, assignment is discouraged in favor of single assignment, also called initialization. Single assignment is an example of name binding and differs from assignment as described in this article in that it can only be done once, usually when the variable is created; no subsequent reassignment is allowed.

An evaluation of expression does not have a side effect if it does not change an observable state of the machine,[5] and produces same values for same input.[4] Imperative assignment can introduce side effects while destroying and making the old value unavailable while substituting it with a new one,[6] and is referred to as destructive assignment for that reason in LISP and functional programming, similar to destructive updating.

Single assignment is the only form of assignment available in purely functional languages, such as Haskell, which do not have variables in the sense of imperative programming languages[4] but rather named constant values possibly of compound nature with their elements progressively defined on-demand. Purely functional languages can provide an opportunity for computation to be performed in parallel, avoiding the von Neumann bottleneck of sequential one step at time execution, since values are independent of each other.[7]

Impure functional languages provide both single assignment as well as true assignment (though true assignment is typically used with less frequency than in imperative programming languages). For example, in Scheme, both single assignment (with ) and true assignment (with ) can be used on all variables, and specialized primitives are provided for destructive update inside lists, vectors, strings, etc. In OCaml, only single assignment is allowed for variables, via the syntax; however destructive update can be used on elements of arrays and strings with separate operator, as well as on fields of records and objects that have been explicitly declared mutable (meaning capable of being changed after their initial declaration) by the programmer.

Functional programming languages that use single assignment include Clojure (for data structures, not vars), Erlang (it accepts multiple assignment if the values are equal, in contrast to Haskell), F#, Haskell, Lava, OCaml, Oz (for dataflow variables, not cells), Racket (for some data structures like lists, not symbols), SASL, Scala (for vals), SISAL, Standard ML. Non-backtrackingProlog code can be considered explicit single-assignment, explicit in a sense that its (named) variables can be in explicitly unassigned state, or be set exactly once. In Haskell, by contrast, there can be no unassigned variables, and every variable can be thought of as being implicitly set to its value (or rather to a computational object that will produce its value on demand) when it is created.

Value of an assignment[edit]

In some programming languages, an assignment statement returns a value, while in others it does not.

In most expression-oriented programming languages (for example, C), the assignment statement returns the assigned value, allowing such idioms as , in which the assignment statement returns the value of , which is then assigned to . In a statement such as , the return value of a function is used to control a loop while assigning that same value to a variable.

In other programming languages, Scheme for example, the return value of an assignment is undefined and such idioms are invalid.

In Haskell,[8] there is no variable assignment; but operations similar to assignment (like assigning to a field of an array or a field of a mutable data structure) usually evaluate to the unit type, which is represented as . This type has only one possible value, therefore containing no information. It is typically the type of an expression that is evaluated purely for its side effects.

Variant forms of assignment[edit]

Certain use patterns are very common, and thus often have special syntax to support them. These are primarily syntactic sugar to reduce redundancy in the source code, but can also simplify compilation by clarifying the programmer's intent and easing analysis of the source code.

Augmented assignment[edit]

Main article: Augmented assignment

The case where the assigned value depends on a previous one is so common that many imperative languages, most notably C and the majority of its descendants, provide special operators called augmented assignment, like , so can instead be written as .[3] Beyond syntactic sugar, this simplifies compilation, since it makes it clear that in-place modification of the variable is possible.

Chained assignment[edit]

A statement like is called a chained assignment in which the value of is assigned to multiple variables and . Chained assignments are often used to initialize multiple variables, as in

Not all programming languages support chained assignment. Chained assignments are equivalent to a sequence of assignments, but the evaluation strategy differs between languages. For simple chained assignments, like initializing multiple variables, the evaluation strategy does not matter, but if the targets (l-values) in the assignment are connected in some way, the evaluation strategy affects the result.

In some programming languages (C for example), chained assignments are supported because assignments are expressions, and have values. In this case chain assignment can be implemented by having a right-associative assignment, and assignments happen right-to-left. For example, is equivalent to . In C++ they are also available for values of class types by declaring the appropriate return type for the assignment operator.

In Python, assignment statements are not expressions and thus do not have a value. Instead, chained assignments are a series of statements with multiple targets for a single expression. The assignments are executed left-to-right so that evaluates the expression , then assigns the result to the leftmost target, , and then assigns the same result to the next target, , using the new value of .[9] This is essentially equivalent to though no actual variable is produced for the temporary value.

Parallel assignment[edit]

Some programming languages, such as APL, Go,[10]JavaScript (since 1.7), PHP, Maple, Lua, occam 2,[11]Perl,[12]Python,[13]REBOL, Ruby,[14] and Windows PowerShell allow several variables to be assigned in parallel, with syntax like:

a, b := 0, 1

which simultaneously assigns 0 to and 1 to . This is most often known as parallel assignment; it was introduced in CPL in 1963, under the name simultaneous assignment,[15] and is sometimes called multiple assignment, though this is confusing when used with "single assignment", as these are not opposites. If the right-hand side of the assignment is a single variable (e.g. an array or structure), the feature is called unpacking[16] or destructuring assignment:[17]

var list := {0, 1} a, b := list

The list will be unpacked so that 0 is assigned to and 1 to . More interestingly,

a, b := b, a

swaps the values of and . In languages without parallel assignment, this would have to be written to use a temporary variable

var t := a a := b b := t

since leaves both and with the original value of .

Some languages, such as Go and Python, combine parallel assignment, tuples, and automatic tuple unpacking to allow multiple return values from a single function, as in this Python example:


This provides an alternative to the use of output parameters for returning multiple values from a function. This dates to CLU (1974), and CLU helped popularize parallel assignment generally.

In C and C++, the comma operator is similar to parallel assignment in allowing multiple assignments to occur within a single statement, writing instead of . This is primarily used in for loops, and is replaced by parallel assignment in other languages such as Go.[18] However, the above C++ code does not ensure perfect simultaneity, since the right side of the following code is evaluated after the left side. In languages such as Python, will assign the two variables concurrently, using the initial value of a to compute the new b.

Assignment versus equality[edit]

See also: Relational operator § Confusion with assignment operators

The use of the equals sign as an assignment operator has been frequently criticized, due to the conflict with equals as comparison for equality. This results both in confusion by novices in writing code, and confusion even by experienced programmers in reading code. The use of equals for assignment dates back to Heinz Rutishauser's language Superplan, designed from 1949 to 1951, and was particularly popularized by Fortran:

A notorious example for a bad idea was the choice of the equal sign to denote assignment. It goes back to Fortran in 1957[a] and has blindly been copied by armies of language designers. Why is it a bad idea? Because it overthrows a century old tradition to let “=” denote a comparison for equality, a predicate which is either true or false. But Fortran made it to mean assignment, the enforcing of equality. In this case, the operands are on unequal footing: The left operand (a variable) is to be made equal to the right operand (an expression). x = y does not mean the same thing as y = x.[19]

— Niklaus Wirth, Good Ideas, Through the Looking Glass

Beginning programmers sometimes confuse assignment with the relational operator for equality, as "=" means equality in mathematics, and is used for assignment in many languages. But assignment alters the value of a variable, while equality testing tests whether two expressions have the same value.

In some languages, such as BASIC, a single equals sign () is used for both the assignment operator and the equality relational operator, with context determining which is meant. Other languages use different symbols for the two operators. For example:

  • In Pascal, the assignment operator is a colon and an equals sign () while the equality operator is a single equals ().
  • In C, the assignment operator is a single equals sign () while the equality operator is a pair of equals signs ().
  • In R, the assignment operator is basically , as in , but a single equals sign can be used in certain contexts.

The similarity in the two symbols can lead to errors if the programmer forgets which form ("", "", "") is appropriate, or mistypes "" when "" was intended. This is a common programming problem with languages such as C (including one famous attempt to backdoor the Linux kernel [20]), where the assignment operator also returns the value assigned (in the same way that a function returns a value), and can be validly nested inside expressions. If the intention was to compare two values in an statement, for instance, an assignment is quite likely to return a value interpretable as Boolean true, in which case the clause will be executed, leading the program to behave unexpectedly. Some language processors (such as gcc) can detect such situations, and warn the programmer of the potential error.


See also: Comparison of programming languages (variable and constant declarations)

The two most common representations for the copying assignment are equals sign () and colon-equals (). Both forms may semantically denote either an assignment statement or an assignment operator (which also has a value), depending on language and/or usage.

Fortran, PL/I, C (and descendants such as C++, Java, etc.), Bourne shell, Python, Go (assignment to pre-declared variables), R, Windows PowerShell, etc.
ALGOL (and derivatives), Simula, CPL, BCPL, Pascal[21] (and descendants such as Modula), Mary, PL/M, Ada, Smalltalk, Eiffel,[22][23]Oberon, Dylan,[24]Seed7, Go (shorthand for declaring and defining a variable),[25]Io, AMPL, ML,[26] etc.

Other possibilities include a left arrow or a keyword, though there are other, rarer, variants:

Mathematical pseudo code assignments are generally depicted with a left-arrow.

Some platforms put the expression on the left and the variable on the right:

Some expression-oriented languages, such as Lisp[28][29] and Tcl, uniformly use prefix (or postfix) syntax for all statements, including assignment.

See also[edit]



  1. ^ abTopics in Information Processing
  2. ^ abcImperative Programming
  3. ^ abcRuediger-Marcus Flaig (2008). Bioinformatics programming in Python: a practical course for beginners. Wiley-VCH. pp. 98–99. ISBN 978-3-527-32094-3. Retrieved 25 December 2010. 
  4. ^ abcdeCrossing borders: Explore functional programming with HaskellArchived November 19, 2010, at the Wayback Machine., by Bruce Tate
  5. ^Mitchell, John C. (2003). Concepts in programming languages. Cambridge University Press. p. 23. ISBN 978-0-521-78098-8. Retrieved 3 January 2011. 
  6. ^Imperative Programming Languages (IPL)
  7. ^John C. Mitchell (2003). Concepts in programming languages. Cambridge University Press. pp. 81–82. ISBN 978-0-521-78098-8. Retrieved 3 January 2011. 
  8. ^Hudak, Paul (2000). The Haskell School of Expression: Learning Functional Programming Through Multimedia. Cambridge: Cambridge University Press. ISBN 0-521-64408-9. 
  9. ^https://docs.python.org/reference/simple_stmts.html#assignment-statements
  10. ^The Go Programming Language Specification: Assignments
  11. ^INMOS Limited, ed. (1988). Occam 2 Reference Manual. New Jersey: Prentice Hall. ISBN 0-13-629312-3. 
  12. ^Wall, Larry; Christiansen, Tom; Schwartz, Randal C. (1996). Perl Programming Language (2 ed.). Cambridge: O´Reilly. ISBN 1-56592-149-6. 
  13. ^Lutz, Mark (2001). Python Programming Language (2 ed.). Sebastopol: O´Reilly. ISBN 0-596-00085-5. 
  14. ^Thomas, David; Hunt, Andrew (2001). Programming Ruby: The Pragmatic Programmer's Guide. Upper Saddle River: Addison Wesley. ISBN 0-201-71089-7. 
  15. ^D.W. Barron et al., "The main features of CPL", Computer Journal6:2:140 (1963). full text (subscription)
  16. ^http://legacy.python.org/dev/peps/pep-3132/
  17. ^https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
  18. ^Effective Go: for, "Finally, Go has no comma operator and ++ and -- are statements not expressions. Thus if you want to run multiple variables in a for you should use parallel assignment (although that precludes ++ and --)."
  19. ^Niklaus Wirth. "Good Ideas, Through the Looking Glass". CiteSeerX 
  20. ^Corbet (6 November 2003). "An attempt to backdoor the kernel". 
  21. ^Moore, Lawrie (1980). Foundations of Programming with Pascal. New York: John Wiley & Sons. ISBN 0-470-26939-1. 
  22. ^Meyer, Bertrand (1992). Eiffel the Language. Hemel Hempstead: Prentice Hall International(UK). ISBN 0-13-247925-7. 
  23. ^Wiener, Richard (1996). An Object-Oriented Introduction to Computer Science Using Eiffel. Upper Saddle River, New Jersey: Prentice Hall. ISBN 0-13-183872-5. 
  24. ^Feinberg, Neal; Keene, Sonya E.; Mathews, Robert O.; Withington, P. Tucker (1997). Dylan Programming. Massachusetts: Addison Wesley. ISBN 0-201-47976-1. 
  25. ^The Go Programming Language Specification: short variable declarations
  26. ^Ullman, Jeffrey D. (1998). Elements of ML Programming: ML97 Edition. Englewood Cliffs, New Jersey: Prentice Hall. ISBN 0-13-790387-1. 
  27. ^Iverson, Kenneth E. (1962). A Programming Language. John Wiley and Sons. ISBN 0-471-43014-5. 
  28. ^Graham, Paul (1996). ANSI Common Lisp. New Jersey: Prentice Hall. ISBN 0-13-370875-6. 
  29. ^Steele, Guy L. (1990). Common Lisp: The Language. Lexington: Digital Press. ISBN 1-55558-041-6. 
  30. ^Dybvig, R. Kent (1996). The Scheme Programming Language: ANSI Scheme. New Jersey: Prentice Hall. ISBN 0-13-454646-6. 
  31. ^Smith, Jerry D. (1988). Introduction to Scheme. New Jersey: Prentice Hall. ISBN 0-13-496712-7. 
  32. ^Abelson, Harold; Sussman, Gerald Jay; Sussman, Julie (1996). Structure and Interpretation of Computer Programs. New Jersey: McGraw-Hill. ISBN 0-07-000484-6. 
  1. ^Use of predates Fortran, though it was popularized by Fortran.

Copyright 2014-2018


  • 3rd party: the author of code that is neither yourself or part of a standard programming language
  • absolute: A numerical distance from zero (always an unsigned value).
  • absolute address: A specific address (in reference to absolute position) in memory.
  • absolute path: the permanent address or location of a file within a file system
  • abstract: separating the conceptualization from the actual implementation of an idea.
  • accumulator: a variable that is regularly incremented in order to control a while loop
  • accumulator variable: An accumulator variable is a variable that is declared outside of a loop and used within a loop to keep track of information throughout all loop iterations. For example, you could create a 'total' variable outside of a loop and then add values to this variable from within the loop to create a running total of values.
  • total = 0 while True: number = int(input("Enter a number, 0 to end: ")) if number == 0: break total += number print ("Your total is", total)
  • address: A location of data (usually in memory or some other storage device).
  • algorithm: a series of instructions used to solve a problem
  • alphanumeric: all the alphabet character (upper and lower case) as well as number characters (A-Z, a-z, and 0-9)
  • argument: Data that is provided to a function when the function is called.
  • ascii: American Standard Code for Information Interchange; the encoding scheme between characters to their corresponding numerical values
  • ascii: American Standard Code for Information Interchange is a character-encoding scheme used to convert printable and control characters to/from numerical equivalents.
  • assignment operator: The assignment operator is used to tell Python to store information in a variable. The single equal sign ( = ) is the assignment operator in Python. For example:
  • foo = 5
  • assignment operator ( = ): The assignment operator is used to tell Python to store information in a variable. The single equal sign ( = ) is the assignment operator in Python.
  • associated array: see 'dictionary'
  • augmented assignment: The augmented assignment operators (+=, -=, /=, *=, etc) are 'shortcut' operators for a self-referential assignment. For example, these two statements are the same: a = a + 1 vs. a += 1
  • augmented assignment operators: The augmented assignment operators (+=, -=, /=, *=, etc) are 'shortcut' operators for a self-referential assignment. For example, these two statements are the same:
  • a = a + 1 a += 1
  • base case: the most basic
  • big o notation: used to evaluate the upper bounds of an algorithms theoretical performance given different situations and determine it's performance to an order (what the "O" stands for) of magnitude.
  • binary file: a file that is encoded in binary (strings of 0's and 1's)
  • block: see 'code block'
  • body: a code block that are associated with a specific program structure such as a function, conditional, or loop structure
  • boolean: a value of either true or false
  • boolean expression: an expression that evaluates to a boolean value
  • boolean logic: calculate logical expressions that result in a boolean value
  • branch: one possible path of a decision tree
  • "break": Called from inside a loop, the break statement immediately terminates the loop and causes Python to continue the program starting on the line directly after the loop. For example:
  • while True: print (a) a += 1 if a >= 5: break
  • bug: any type of error in your code that causes it to run not as desired
  • catch: the second half of a try-catch block. indicates what should be done if the operation that was "tried" failed
  • chained conditional: chaining a series of if else statements together into an if ... elif ... else structure
  • character: a single symbol, number, letter, or non-printable control character
  • chr: see 'character'
  • 'chr' function: a function used to convert an ASCII value into a character
  • close: The 'close' method is a method that can be called on a 'file object'. The 'close' method is used to tell your computer's operating system that you are finished working with a data source. It is good practice to close your data sources when you are finished working with them.accumulator
  • 'close' function: a function in Python used to close a file so that it is no longer accessible and any data being buffered is flushed (any pending read/write operations are completed)
  • code: short for "source code"
  • code block: a section of code that is grouped together
  • codeblock: a series of statements at the same level of indentation
  • coding style: rules regarding code formatting (spacing, etc.), naming conventions, and other options that don't pertain to logical or syntax issues, but affect code readability
  • comment: A comment is an arbitrary bit of text that you can include in your source code for documentation purposes. The Python interpreter ignores any line that is marked as a comment. Python supports two kinds of comments - the single line comment and the multi line comment. Single line comments are written using the # character - anything after a single # will be ignored by the Python interpreter. Multi line comments are written using the """ character sequence. Anything after this sequence is ignored until another set of """ characters is encountered.
  • comparison operator: an operator that compares two values
  • concatenate: to append one string onto another
  • concatenation: Concatenation is the process of combining two or more Strings into a new, larger String. In Python you can concatenation two Strings using the + operator. For example:
  • compound_word = "tom" + "or" + "row"
  • concise: short and to the point. what your programs should be.
  • conditional statement: a statement that has one or more potential different outcomes usually using some for of if-elseif-else statement
  • "continue": Called from inside a loop, the continue statement immediately terminates the current iteration of the loop. When called from within a 'while' loop it will cause Python to re-evaluate the condition attached to the 'while' keyword. When called from within a 'for' loop it will cause Python to go to the next item in the current iterable.
  • cpu: Central Processing Unit, the main processor in a computer that does most of the computations.
  • crash: when a program terminates due to an uncaught exception or 'bug'
  • data: information that is stored in digital form
  • data type: The 'data type' for a value describes the type of data being stored in memory. For example:
  • a = 5 b = 5.5 c = "five"
  • debugging: a process used to find errors and problems in your code
  • decision tree: given a series of conditional statements, a decision tree is all possible paths that could result from following those statements
  • deep copy: creating a new object and copying over the values
  • 'def' statement: a keyword in Python that is used to define a new function
  • default parameters: in programming a default parameter is a parameter that has a default value, but that value may be overridden if desired, usually by passing a a parameter that has a value other than the default
  • defensive coding: writing source code with robustness as a major consideration
  • delimiter: A delimiter is a sequence of one or more characters used to specify the beginning and ending point in a String. In Python you can use the ", ', """ or ''' characters as String delimiters.
  • deterministic: a process that is repeatable and predictable
  • 'dict' function: function that creates an empty dictionary
  • dict object: a object which stores data in a dictionary form and the functions that are used to access and modify that data
  • 'dict()' function: a data structure that maps keys to values
  • dictionary: a data structure that stores a key which maps to some data
  • directory: the name for a folder in a file system
  • .doc: A Microsoft word document
  • documentation: In programming any comments in the source code including headers, pydocs, and inline comments.
  • dry principle: Don't Repeat Yourself - a principle that any time you are repeating yourself, your code may need to be refactored to reduce redundancy so that code is easier to maintain and more modular
  • edge case: inputs at the valid boundary of an algorithm or function
  • 'elif' statement: Short for "else if" is the continuation of an 'if' statement and the code nested inside of an 'elif' statement will execute if the condition specified is the 'if' statement is false, but only if the condition specified by the 'elif' statement is true.
  • 'else' statement: a keyword in Python that optionally follows an 'if' statement or 'elif' statement whose subsequent block of code will only run if the previous if/elif expressions were false.
  • encode: an additional representation of a value. often numerical representation of text (such as ASCII)
  • encoding: a different representation of a string or number based on some algorithm
  • except: a block of code that "catches" exceptions before they crash your program. See "try" for more information.
  • 'except' statement: used to 'catch' or 'handle' different types of exceptions that may be 'thrown' by a program when it tries to do something and fails
  • exception: an error condition that causes a program to halt while running
  • exclusive: excluding a value
  • execute: to run a program
  • expression: a series of one or more operators and their values to evaluate down to a single value
  • fence post error: a specific type of off-by-one error
  • file: a collection of textual characters
  • file extension: last part of the file name after the final period that denotes the type of the file
  • finagle's law: "anything that can go wrong, will -- and at the worst possible moment"
  • float: see 'floating point number'
  • float function: The 'float' function accepts one value as an argument and attempts to convert that value into a floating point number. If successful it will return a floating point number. For example:
  • a = "5.5" # string b = float(a) # b is a float
  • floating point number: A floating point number is a data type in Python that represents a number with a decimal value. Floating point numbers can be positive, negative or zero, and they will always contain a decimal point (even if it isn't required)
  • for loop: a code block that is repeated for a set number of iterations
  • 'for' loop: a loop structure used to iterate over a sequence of items
  • format function: The 'format' function allows you to create formatted versions of integers, floats and Strings. It accepts two arguments - the data to be formatted and a formatting pattern. The format() function always returns a String.
  • formatting pattern: A string sent as an argument to the 'format' function that determines how a given string will be displayed on the screen.
  • fractal: a geometric figure, each part of which has the same structure as the whole
  • function: A function is a pre-written piece of computer code that can be invoked to perform a specific action or set of actions.
  • function call: The act of invoking a function. When you 'run' a function we say that the function has been 'called'.
  • functions: a series of statements that together perform an action
  • global variable: a variable whose scope is accessible throughout the entire program or module (shared between functions in a module)
  • gui: Graphic User Interface - a program that interacts with the user using some kind of graphical interface besides text
  • hard drive: data storage device inside computer
  • hardcoding: specifying literal values into programming code
  • hashmap: A mapping of specific keys (often generated using a randomized unique 'hash') to a corresponding value. Also, see 'dictionary'.
  • header: the first line of an 'if' statement
  • ide: acronym standing for Integrated Developer Environment
  • identifier: the name for a variable or function
  • idle: IDLE is a basic editor and interpreter environment that ships with the standard distribution of Python. It is used to write and execute Python source code.
  • 'if' statement: a conditional statement that controls the flow of a program based on boolean values.
  • 'if' statement: a statement which determines if a boolean expression is true or false
  • immutable: Incapable of being modified
  • import: a keyword in Python that is used to gain access to other libraries
  • inclusive: Including a value
  • indentation: a way to indicate by using spacing where functions and loops begin and end
  • index: the position of an element
  • initialized: something that has been not just defined, but also set-up or configured in a certain way
  • input function: The 'input' function can be used to ask the user a question. The user can then respond using their keyboard, and the value they supply can be used within your program. 'input' takes one argument (a String which represents the question you wish to ask the user) and it returns a String (the text that the user types in). Since the 'input' function always returns a String it is often necessary to convert its return value into a numeric value using the 'int' or 'float' functions.
  • int: see 'integer'
  • int function: The 'int' function accepts one value as an argument and attempts to convert that value into a integer. If successful it will return an integer. For example:
  • a = "5" # string b = int(a) # b is an integer
  • integer: An integer is a data type in Python that represents a whole number. Integers can be positive, negative or zero, and an never contain a decimal point.
  • interactive mode: IDLE has an interactive interpreter which means that you can try out single lines of code and directly see the result.
  • interactive shell: a real-time interpreter that allows the execution of certain commands or statements
  • invalid inputs: input that is incompatible with what the function is expecting (such as sending a string when an int is expected) and will cause the function to crash
  • item: a unit of data or an object
  • iterable: An type of data that can be iterated over to give one piece of that data at a time.
  • iterate: to complete one occurrence of something
  • iteration: one occurrence of something
  • iterator: the value that is being iterated on
  • key: a unique immutable piece of data used to lookup ('unlock') the value associated with that key
  • keyword: a word that has a special meaning and is reserved for the programming language; keywords can not be used for the names of variables, functions, or other developer named attributes.
  • library: a collection of functions for use by other programs
  • limited scope of knowledge: The principle that allows us to use a module or library without knowing exactly how it works (via adequate documentation).
  • list: a series of items
  • literal: hard coded values such as "hello" or 5
  • local variable: a variable that is created within a function and can be accessed only within that function
  • logic error: A logic error is an error in which your code runs and does not crash, but it does not perform in a desired manner.
  • logical expression: an to using logical operators to evaluate to a boolean value
  • logical operator: an operator that performs boolean logic on either one or two values depending on the operator
  • loop: a structure that executes a codeblock either a given number of times or based on a certain condition
  • magic numbers: arbitrary values that are hardcoded into programming logic
  • map: a relationship between two items (usually a directed relationship)
  • mapping: a correlation between two or more values
  • memory: a general term for where data can be stored, but often more specially referring to RAM hardware on a computer
  • method: a function that is part of an object
  • mixed type expression: A mixed type expression is an expression that involves two or more data types. In Python this usually involves a math expression that contains both integers and floating point numbers.
  • module: Any of a number of distinct but interrelated units from which a program may be built up or into which a complex activity may be analyzed. In Python, a file containing Python definitions and statements usually of closely related to each other (e.g., math)
  • modulus operator: an operator that returns the remainder when the first operand is divided by the second operand
  • mutable: changeable
  • namespace: a list of the names of all variables, functions, objects etc. that have been defined
  • natural language: A spoken and/or written language that is used naturally by people in every day life
  • nest: putting one function or statement within another function or statement
  • nested: a programming structure that is inside of another programming structure
  • numeric: a number
  • numeric literal: A numeric literal is the representation of a numeric value within the source code of a computer program.
  • object: In programming, an object is a programming data structure that links data with the functions (called 'methods') that access or modify that data.
  • object oriented programming (oop): data centered approach to program design
  • off-by-one error: often when a loop iterates the wrong number of times and generates a result that is one off the expected result
  • oop: Object Oriented Programming - a programming paradigm where most data is stored as objects
  • 'open' function: The 'open' function in Python is used to request access to an external data source. It accepts two arguments - the name of the data source (a filename) and the 'mode' in which you plan on accessing that data source ('w' for writing, 'a' for appending or 'r' for reading). The open function returns a 'file object' which can be used to interface with the desired data source.
  • 'open' function: a function in Python used to open a file for subsequent read, write, or execution
  • operand: An object that is used in conjunction with an operator to form an expression. For example, the numbers 4 and 5 are operands in this expression: 4 + 5
  • operating system: the software that supports a computer's basic functions
  • operator: An operator is a built-in command that performs some action on a series of operands. For example, the addition operator (+) can be used to add two numbers.
  • 'ord' function: in Python a function that returns the ASCII value of a character (short for ordinality)
  • package: a series of modules or libraries that may be packaged together as one unit
  • parameter: a value being passed to some kind of programming structure be it a program, function, operator, etc.
  • parse: a way of splitting a file into meaningful sections for reading or manipulation
  • path: the heirachical location of a file on a computer's file system
  • pemdas: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction - the standard order in which mathematical operations are completed
  • pixel: the smallest unit that is able to be displayed on a physical devices, or the smallest unit of storage in an image
  • plain-text: a file comprised entirely of ASCII/UTF-8 character set encoded data (e.g. source code)
  • plain-text file: see 'text file'
  • prime: a number that is only evenly divisible (no remainder) by the numbers 1 and the number itself.
  • print function: A built-in Python function that can be used to display printed text to the screen. Print takes any number of arguments of any data type.
  • pseudo-random number: A number that is not genuinely random but is instead created algorithmically
  • pseudocode: a language independent way to formulate algorithms, often used in the design process of development
  • pydoc: documentation system for python that automatically generates documentation from Python module source code comments
  • random number: A number that is generated in such a way as to exhibit statistical randomness
  • random number generator: A function that will provide you with random numbers, usually between 0 and 1
  • 'range' function: a function that will iterate a certain number of times over a specified range
  • 'read' function: a function in Python that reads data from a file
  • recursion: an algorithm which uses itself in the definition of that algorithm
  • recursive: a type of algorithm that calls itself until reaching a base case
  • recursive case: in recursion, the part of a recursive algorithm in which the algorithm calls itself
  • recursive data structure: a data structure which is capable of storing a data structure of it's own type
  • reference: when you have a pointer to a value rather than the value itself
  • repetition: the act of repeating the same process multiple times
  • repetition structure: Repetition structures are used to to repeatedly execute a series of instructions until some condition is met. When the condition is met the loop terminates. Python supports a condition controlled repetition structure ("while" loops) and a count controlled repetition structure ("for" loops)
  • 'return' statement: keyword used at the end of a function to indicate which value will be passed back to the caller of the function
  • return value: the value that is returned by a function. In effect a function call is subsequently replaced by the value it returns
  • returns: a type of function that generates some value and then sends it back to the caller of the function (as opposed to a non-returning function)
  • robust: something that can function under abnormal circumstances
  • .rtf: A rich-text file
  • runtime error: A runtime error is any error that causes your program to 'crash' during execution.
  • scope: the block(s) of code which a variable is accessible
  • self-documenting code: source code whose variables and function names are descriptive enough that it limits the number of comments needed
  • self-referential assignment: A self-referential assignment statement is statement in which the variable being modified (on the left side) is included as part of the new value for the variable (on the right side). For example, in this expression the new value of 'a' is equal to the current value of 'a' plus one: a = a + 1
  • self-referential assignment statement: A self-referential assignment statement is statement in which the variable being modified (on the left side) is included as part of the new value for the variable (on the right side). For example, in this expression the new value of 'a' is equal to the current value of 'a' plus one:
  • a = a + 1
  • semantics: the meanings of the words and symbols in a program
  • sequence: a series of items in a specific order
  • set: a series of unique items that have not defined order
  • shallow copy: create new object with references to values in old object
  • short-circuit: when an engineered or designed path is subverted using a shorter path of less resistance
  • short-circuit evaluation: in programming, the act of omitting certain operations that are unnecessary due to logical conditions in order to improve performance
  • skeleton code: source code which provides a general frame where code will be added in later to provide a full implementation
  • slice: to take a jointed subset of items from an series of pieces of data
  • source code: the statements in plain-text that comprise a program (or part of a program)
  • split: Splitting is a technique used to extract portions of a String into a list. In Python we can use the .split() method on the String class to 'cut' a String into smaller pieces based on the location of a separator character. For example, you can take the String 'apple,pear,peach' and split it apart based on the position of the ',' characters. The resulting list would contain 3 elements.
  • standard library: A collection of modules that are part of the normal installation of a programming language
  • statement: a single command
  • step size: a number indicating by how much to jump between numbers when using the range function
  • str: see 'string'
  • str function: The 'str' function accepts one value as an argument and converts that value into a String. It returns a String to the caller of the function. For example:
  • a = 5.5 # float b = str(a) # b is a String
  • string: One of the basic data types in Python that is designed to store textual information.
  • string literal: A string literal is the representation of a String value within the source code of a computer program.
  • substring: any portion of a string literal
  • syntax: the rules pertaining to structure and punctuation of statements
  • syntax error: A syntax error results in not following the rules of the Python language.
  • tab: a variable width amount of whitespace often equivalent to 4 or 8 spaces, used for indenting codeblocks
  • tcl/tk: toolkit to provide GUI widgets
  • text file: a file on a computer that is comprised entirely of ASCII or an extended ASCII encoding (such as UTF-8).
  • tkinter: a graphical library used by python to display simple window based UIs
  • traceback: the series of functions that were currently still active up to the point in which an error occurred, the traceback lists these functions in the order in which they were called
  • traversing hierarchies: to iterate over a series of files
  • truncate: Shortening something by simply removing certain parts of it.
  • try: Keyword in Python that is used to try and perform a statement that may fail. You can then catch that failure instead of the program crashing.
  • 'try' statement: used when some code may cause an exception to avoid a program from crashing
  • turtle: a Python module that allows for basic graphical representation for drawing simple geometric patterns such as lines.
  • ui: User Interface
  • unit test: a series of tests designed to test all possible conditions for a given unit (function, object, etc.) to ensure robust code development
  • unit testing: s a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures are tested to determine if they are fit for use.
  • url: Universal Resource Locator - a standard file format specification that is used to describe the location of a resource be it a local file, a website stream, or some other resource
  • urllib: in Python, a library used to access URLs
  • value: a unit of data
  • variable: A variable is a storage location and an associated symbolic name (an identifier) which contains some known or unknown quantity or information.
  • 'while' loop: The 'while' keyword in Python is used to define a condition controlled loop. 'while' keywords must always be followed by a boolean expression. Statements indented under a 'while' keyword are executed as long as the condition attached to the 'while' keyword evaluates to True.
  • while loop: a repetition structure that repeats so long as a specified condition evaluates to 'true'
  • whitespace: any type of space characters including spaces, tabs, new lines, etc.
  • whole number: A whole number is any non-negative numeric value that doesn't contain a decimal point({0, 1, 2, 3, ...}).
  • wildcard: a character that means it should match everything, on most systems that character is the asterisk ('*')
  • write: The 'write' method is a method that can be called on a 'file object'. The 'write' method is used to write data to a data source once it has been opened for writing or appending.
  • 'write' function: see write

One thought on “Pseudo Code Assignment Statement Python

Leave a comment

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *