text
stringlengths
1
1k
source
stringlengths
31
152
{\displaystyle n} equally spaced discrete time intervals, and where f ^ {\displaystyle {\hat {f}}} and ...
https://en.wikipedia.org/wiki/Dynamic_programming
han minimize) some dynamic social welfare function. In Ramsey's problem, this function relates amounts of consumption to levels of utility. Loosely speaking, the planner faces the trade-off between contemporaneous consumption and future consumption (via investment in capital stock that is used in production), known as ...
https://en.wikipedia.org/wiki/Dynamic_programming
, c t ) = f ( k t ) − c t ...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle c_{t}} be consumption in period t, and assume consumption yields utility u ( c t ) = ln ⁡ ( c ...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle k_{0}>0} , and suppose that this period's capital and consumption determine next period's capital as k t + 1 = A k t ...
https://en.wikipedia.org/wiki/Dynamic_programming
ln ⁡ ( c t ) {\displaystyle \max \sum _{t=0}^{T}b^{t}\ln(c_{t})} subject to k t + 1 ...
https://en.wikipedia.org/wiki/Dynamic_programming
0 , c 1 , c 2 , … , c T {\displaystyle c_{0},c_{1...
https://en.wikipedia.org/wiki/Dynamic_programming
1 , 2 , … , T , T + 1 {\displaystyle t=0,1,2,\ldots ,T,T+1} which represent the value of having any amount of capital k at each time t. There is (by assumption) no utility from having capital after death, ...
https://en.wikipedia.org/wiki/Dynamic_programming
( k t ) = max ( ln ⁡ ( c t ) ...
https://en.wikipedia.org/wiki/Dynamic_programming
a − c t ≥ 0 {\displaystyle k_{t+1}=Ak_{t}^{a}-c_{t}\geq 0} This problem is much simpler than the one we wrote down before, because it involves only two decision variab...
https://en.wikipedia.org/wiki/Dynamic_programming
c t {\displaystyle c_{t}} and saving k t + 1 {\displaystyle k_{t+1}} . To actually solve this problem, we work bac...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle V_{0}(k)} , which is the value of the initial decision problem for the whole lifetime. In other words, once we know V T − j + 1 ( k ) ...
https://en.wikipedia.org/wiki/Dynamic_programming
− c T − j ) {\displaystyle \ln(c_{T-j})+bV_{T-j+1}(Ak^{a}-c_{T-j})} , where c T − j ...
https://en.wikipedia.org/wiki/Dynamic_programming
( k ) = a ∑ i = 0 j a i b i ...
https://en.wikipedia.org/wiki/Dynamic_programming
T − j ( k ) = 1 ∑ i = 0 ...
https://en.wikipedia.org/wiki/Dynamic_programming
( k ) = A k a ...
https://en.wikipedia.org/wiki/Dynamic_programming
a b c T − 2 ( ...
https://en.wikipedia.org/wiki/Dynamic_programming
b 2 ...
https://en.wikipedia.org/wiki/Dynamic_programming
a b + a 2 b 2 ...
https://en.wikipedia.org/wiki/Dynamic_programming
c 1 ( k ) = A ...
https://en.wikipedia.org/wiki/Dynamic_programming
… + a T − 2 b ...
https://en.wikipedia.org/wiki/Dynamic_programming
c 0 ( k ) = ...
https://en.wikipedia.org/wiki/Dynamic_programming
+ … + a T − 2 ...
https://en.wikipedia.org/wiki/Dynamic_programming
+ a T b T ...
https://en.wikipedia.org/wiki/Dynamic_programming
ally consuming all remaining wealth in period T, the last period of life. === Computer science === There are two key attributes that a problem must have in order for dynamic programming to be applicable: optimal substructure and overlapping sub-problems. If a problem can be solved by combining optimal solutions to no...
https://en.wikipedia.org/wiki/Dynamic_programming
sub-paths p1 from u to w and p2 from w to v such that these, in turn, are indeed the shortest paths between the corresponding vertices (by the simple cut-and-paste argument described in Introduction to Algorithms). Hence, one can easily formulate the solution for finding shortest paths in a recursive manner, which is w...
https://en.wikipedia.org/wiki/Dynamic_programming
end up solving the same problems over and over if we adopt a naive recursive solution such as this. Dynamic programming takes account of this fact and solves each sub-problem only once. This can be achieved in either of two ways: Top-down approach: This is the direct fall-out of the recursive formulation of any probl...
https://en.wikipedia.org/wiki/Dynamic_programming
lating the problem in a bottom-up fashion: try solving the sub-problems first and use their solutions to build-on and arrive at solutions to bigger sub-problems. This is also usually done in a tabular form by iteratively generating solutions to bigger and bigger sub-problems by using the solutions to small sub-problems...
https://en.wikipedia.org/wiki/Dynamic_programming
tered as an easily accessible design pattern within term-rewrite based languages such as Wolfram Language. === Bioinformatics === Dynamic programming is widely used in bioinformatics for tasks such as sequence alignment, protein folding, RNA structure prediction and protein-DNA binding. The first dynamic programming ...
https://en.wikipedia.org/wiki/Dynamic_programming
ional equation for the shortest path problem by the Reaching method. In fact, Dijkstra's explanation of the logic behind the algorithm, namely Problem 2. Find the path of minimum total length between two given nodes P {\displaystyle P} and Q ...
https://en.wikipedia.org/wiki/Dynamic_programming
g dynamic programming in the calculation of the nth member of the Fibonacci sequence improves its performance greatly. Here is a naïve implementation, based directly on the mathematical definition: function fib(n) if n <= 1 return n return fib(n − 1) + fib(n − 2) Notice that if we call, say, fib(5), we produc...
https://en.wikipedia.org/wiki/Dynamic_programming
se it and update it. The resulting function requires only O(n) time instead of exponential time (but requires O(n) space): var m := map(0 → 0, 1 → 1) function fib(n) if key n is not in map m m[n] := fib(n − 1) + fib(n − 2) return m[n] This technique of saving values that have already been calculated ...
https://en.wikipedia.org/wiki/Dynamic_programming
ewFib := previousFib + currentFib previousFib := currentFib currentFib := newFib return currentFib In both examples, we only calculate fib(2) one time, and then use it to calculate both fib(4) and fib(3), instead of computing it every time either of them is evaluated. === A type of b...
https://en.wikipedia.org/wiki/Dynamic_programming
1 1 0 1 0 ...
https://en.wikipedia.org/wiki/Dynamic_programming
0 0 1 1 0 ...
https://en.wikipedia.org/wiki/Dynamic_programming
] and [ 1 1 0 ...
https://en.wikipedia.org/wiki/Dynamic_programming
0 1 1 ] and [ ...
https://en.wikipedia.org/wiki/Dynamic_programming
1 0 1 0 0 1 ...
https://en.wikipedia.org/wiki/Dynamic_programming
0 0 1 1 0 ...
https://en.wikipedia.org/wiki/Dynamic_programming
0&0&1&1\end{bmatrix}}.} There are at least three possible approaches: brute force, backtracking, and dynamic programming. Brute force consists of checking all assignments of zeros and ones and counting those that have balanced rows and columns (n / 2 zeros and n / 2 ones). As there are ...
https://en.wikipedia.org/wiki/Dynamic_programming
n {\displaystyle {\tbinom {n}{n/2}}^{n}} sensible assignments, this strategy is not practical except maybe up to n = 6 {\displaystyle n=6} . Backtracking for this problem consists of choosing some order of the matri...
https://en.wikipedia.org/wiki/Dynamic_programming
order to be able to accurately count the solutions obtained for each first row value? We consider k × n boards, where 1 ≤ k ≤ n, whose k {\displaystyle k} rows contain n / 2 {\displaystyle n/2} z...
https://en.wikipedia.org/wiki/Dynamic_programming
/ 2 , n / 2 ) , … ( n / 2 , n / 2 ) ) {\displaystyle f((n/2,n/2),(n/2,n/2),\ldots...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle {\tbinom {n}{n/2}}} possible assignments for the top row of the board, and going through every column, subtracting one from the appropriate element of the pair for that column, depending on whether the assignment for the top row contained a zero or a one at that position. If any one of the results...
https://en.wikipedia.org/wiki/Dynamic_programming
1 ) {\displaystyle (0,1)} and n / 2 ( 1 , 0 ) {\displaystyle (1,0)} pairs or not. For example, in the first two boards shown above the sequences of vectors would be ((2, 2) (2, 2) (2, 2) (2, 2)) ((2, 2...
https://en.wikipedia.org/wiki/Dynamic_programming
S) is 1 , 2 , 90 , 297200 , 116963796250 , 6736218287430460752 , … {\displaystyle 1,\,2,\,90,\,297200,\,116963796250,\,6736218287430460752,...
https://en.wikipedia.org/wiki/Dynamic_programming
ward, diagonally right forward, or straight forward. That is, a checker on (1,3) can move to (2,2), (2,3) or (2,4). This problem exhibits optimal substructure. That is, the solution to the entire problem relies on solutions to subproblems. Let us define a function q(i, j) as q(i, j) = the minimum cost to reach square...
https://en.wikipedia.org/wiki/Dynamic_programming
( D ) ) + c ( A ) {\displaystyle q(A)=\min(q(B),q(C),q(D))+c(A)\,} Now, let us define q(i, j) in somewhat more general terms: q ( i , j ) = ...
https://en.wikipedia.org/wiki/Dynamic_programming
min ( q ( i − 1 , j − 1 ) , q ( ...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle q(i,j)={\begin{cases}\infty &j<1{\text{ or }}j>n\\c(i,j)&i=1\\\min(q(i-1,j-1),q(i-1,j),q(i-1,j+1))+c(i,j)&{\text{otherwise.}}\end{cases}}} The first line of this equation deals with a board modeled as squares indexed on 1 at the lowest ...
https://en.wikipedia.org/wiki/Dynamic_programming
) + c(i, j) This function only computes the path cost, not the actual path. We discuss the actual path below. This, like the Fibonacci-numbers example, is horribly slow because it too exhibits the overlapping sub-problems attribute. That is, it recomputes the same path costs over and over. However, we can compute it m...
https://en.wikipedia.org/wiki/Dynamic_programming
r of s, then the predecessor of that square, then the predecessor of that square, and so on recursively, until we reach the starting square. Consider the following pseudocode: function computeShortestPathArrays() for x from 1 to n q[1, x] := c(1, x) for y from 1 to n q[y, 0] := infinity ...
https://en.wikipedia.org/wiki/Dynamic_programming
n, minIndex) function printPath(y, x) print(x) print("<-") if y = 2 print(x + p[y, x]) else printPath(y-1, x + p[y, x]) === Sequence alignment === In genetics, sequence alignment is an important application where dynamic programming is essential. Typically, the problem consists of tr...
https://en.wikipedia.org/wiki/Dynamic_programming
ails of A and B. The partial alignments can be tabulated in a matrix, where cell (i,j) contains the cost of the optimal alignment of A[1..i] to B[1..j]. The cost in cell (i,j) can be calculated by adding the cost of the relevant operations to the cost of its neighboring cells, and selecting the optimum. Different vari...
https://en.wikipedia.org/wiki/Dynamic_programming
ding it onto another rod, on top of the other disks that may already be present on that rod. No disk may be placed on top of a smaller disk. The dynamic programming solution consists of solving the functional equation S(n,h,t) = S(n-1,h, not(h,t)) ; S(1,h,t) ; S(n-1,not(h,t),t) where n denotes the number of disks to b...
https://en.wikipedia.org/wiki/Dynamic_programming
ollowing is a description of the instance of this famous puzzle involving N=2 eggs and a building with H=36 floors: Suppose that we wish to know which stories in a 36-story building are safe to drop eggs from, and which will cause the eggs to break on landing (using U.S. English terminology, in which the first floor ...
https://en.wikipedia.org/wiki/Dynamic_programming
t survives, drop it from the second-floor window. Continue upward until it breaks. In the worst case, this method may require 36 droppings. Suppose 2 eggs are available. What is the lowest number of egg-droppings that is guaranteed to work in all cases? To derive a dynamic programming functional equation for this puzzl...
https://en.wikipedia.org/wiki/Dynamic_programming
, then the test failed. Now, let W(n,k) = minimum number of trials required to identify the value of the critical floor under the worst-case scenario given that the process is in state s = (n,k). Then it can be shown that W(n,k) = 1 + min{max(W(n − 1, x − 1), W(n,k − x)): x = 1, 2, ..., k } with W(n,0) = 0 for all n ...
https://en.wikipedia.org/wiki/Dynamic_programming
al x {\displaystyle x} in the above recurrence, since W ( n − 1 , x − 1 ) {\displaystyle W(n-1,x-1)} is increasing in x ...
https://en.wikipedia.org/wiki/Dynamic_programming
x {\displaystyle x} for each cell in the DP table and referring to its value for the previous cell, the optimal x {\displaystyle x} for each cell can be found in constant time, improving it to O ( ...
https://en.wikipedia.org/wiki/Dynamic_programming
st be dropped to be broken. Let f ( t , n ) {\displaystyle f(t,n)} be the maximum number of values of m {\displaystyle m} that are distinguishable using t ...
https://en.wikipedia.org/wiki/Dynamic_programming
m {\displaystyle m} is from 1 {\displaystyle 1} to a {\displaystyle a} and distinguishable using at most t − 1 {\displaystyle t-1} tries and ...
https://en.wikipedia.org/wiki/Dynamic_programming
= f ( t − 1 , n − 1 ) + f ( t − 1 , n ) {\displaystyle f(t,n)=f(t-1,n-1)+f(t-1,n)} . Then the problem is equivalent to finding the minimum ...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle O(nx)} time. Thus, if we separately handle the case of n = 1 {\displaystyle n=1} , the algorithm would take O ( n k ) ...
https://en.wikipedia.org/wiki/Dynamic_programming
( n ) {\displaystyle O(n)} time using the identity ( t i + 1 ...
https://en.wikipedia.org/wiki/Dynamic_programming
f ( t , n ) ≤ f ( t + 1 , n ) {\displaystyle f(t,n)\leq f(t+1,n)} for all t ≥ 0 {\displaystyle t\geq 0} , we can binary ...
https://en.wikipedia.org/wiki/Dynamic_programming
to multiply matrices ⁠ A 1 , A 2 , . . . . A n {\displa...
https://en.wikipedia.org/wiki/Dynamic_programming
×q, and will require m*n*q scalar multiplications (using a simplistic matrix multiplication algorithm for purposes of illustration). For example, let us multiply matrices A, B and C. Let us assume that their dimensions are m×n, n×p, and p×s, respectively. Matrix A×B×C will be of size m×s and can be calculated in two wa...
https://en.wikipedia.org/wiki/Dynamic_programming
order of parenthesis. At this point, we have several choices, one of which is to design a dynamic programming algorithm that will split the problem into overlapping problems and calculate the optimal arrangement of parenthesis. The dynamic programming solution is presented below. Let's call m[i,j] the minimum number o...
https://en.wikipedia.org/wiki/Dynamic_programming
{\displaystyle p_{i-1}*p_{k}*p_{j}} ) where k ranges from i to j − 1. ⁠ p i − 1 {\displaystyle p_{i-1}} ⁠ is the row dimension of matrix i, ⁠ p ...
https://en.wikipedia.org/wiki/Dynamic_programming
n {\displaystyle A_{1},A_{2},...A_{n}} ⁠: function OptimalMatrixChainParenthesis(chain) n = length(chain) for i = 1, n m[i,i] = 0 // Since it takes no calculations to multiply one matrix for len = 2, n for i = 1, n - len + 1 j = i + ...
https://en.wikipedia.org/wiki/Dynamic_programming
[i, j] = k // Record which k to split on, i.e. where to place the parenthesis So far, we have calculated values for all possible m[i, j], the minimum number of calculations to multiply a chain from matrix i to matrix j, and we have recorded the corresponding "split point"s[i, j]. For example, if we are multiplying ...
https://en.wikipedia.org/wiki/Dynamic_programming
ble values of i and j. The final solution for the entire chain is m[1, n], with corresponding split at s[1, n]. Unraveling the solution will be recursive, starting from the top and continuing until we reach the base case, i.e. multiplication of single matrices. Therefore, the next step is to actually split the chain, i...
https://en.wikipedia.org/wiki/Dynamic_programming
was originally used in the 1940s by Richard Bellman to describe the process of solving problems where one needs to find the best decisions one after another. By 1953, he refined this to the modern meaning, referring specifically to nesting smaller decision problems inside larger decisions, and the field was thereaft...
https://en.wikipedia.org/wiki/Dynamic_programming
d a very interesting gentleman in Washington named Wilson. He was Secretary of Defense, and he actually had a pathological fear and hatred of the word "research". I'm not using the term lightly; I'm using it precisely. His face would suffuse, he would turn red, and he would get violent if people used the term research ...
https://en.wikipedia.org/wiki/Dynamic_programming
ltistage, this was time-varying. I thought, let's kill two birds with one stone. Let's take a word that has an absolutely precise meaning, namely dynamic, in the classical physical sense. It also has a very interesting property as an adjective, and that is it's impossible to use the word dynamic in a pejorative sense. ...
https://en.wikipedia.org/wiki/Dynamic_programming
nym for mathematical optimization. The above explanation of the origin of the term may be inaccurate: According to Russell and Norvig, the above story "cannot be strictly true, because his first paper using the term (Bellman, 1952) appeared before Wilson became Secretary of Defense in 1953." Also, Harold J. Kushner sta...
https://en.wikipedia.org/wiki/Dynamic_programming
0002-9904-1954-09848-8, MR 0067459. Includes an extensive bibliography of the literature in the area, up to the year 1954. Bellman, Richard (1957), Dynamic Programming, Princeton University Press. Dover paperback edition (2003), ISBN 0-486-42809-5. Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Cli...
https://en.wikipedia.org/wiki/Dynamic_programming
c Programming of the Navier-Stokes Equations". Systems and Control Letters. 16 (4): 299–307. doi:10.1016/0167-6911(91)90020-f. Stokey, Nancy; Lucas, Robert E.; Prescott, Edward (1989), Recursive Methods in Economic Dynamics, Harvard Univ. Press, ISBN 978-0-674-75096-8. == External links == A Tutorial on Dynamic prog...
https://en.wikipedia.org/wiki/Dynamic_programming
the birth of Dynamic Programming. Archived 2020-10-13 at the Wayback Machine" Dynamic programming tutorial A Gentle Introduction to Dynamic Programming and the Viterbi Algorithm Tabled Prolog BProlog, XSB, SWI-Prolog IFORS online interactive dynamic programming modules including, shortest path, traveling salesman, knap...
https://en.wikipedia.org/wiki/Dynamic_programming
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically type-checked and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented a...
https://en.wikipedia.org/wiki/Python_(programming_language)
unity. == History == Python was conceived in the late 1980s by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands; it was conceived as a successor to the ABC programming language, which was inspired by SETL, capable of exception handling and interfacing with the Amoeba operating system. Pyth...
https://en.wikipedia.org/wiki/Python_(programming_language)
es Monty Python's Flying Circus. Python 2.0 was released on 16 October 2000, with many major new features such as list comprehensions, cycle-detecting garbage collection, reference counting, and Unicode support. Python 2.7's end-of-life was initially set for 2015, and then postponed to 2020 out of concern that a large ...
https://en.wikipedia.org/wiki/Python_(programming_language)
ntics, at least in a minor way. As of 8 April 2025, Python 3.13.3 is the latest stable release (it's highly recommended to upgrade to it, or upgrade any other older 3.x release). This version currently receives full bug-fix and security updates, while Python 3.12—released in October 2023—had active bug-fix support only...
https://en.wikipedia.org/wiki/Python_(programming_language)
had been insecure because of issues leading to possible remote code execution and web-cache poisoning. Python 3.10 added the | union type operator and added structural pattern matching capability to the language, with the new match and case keywords. Python 3.11 expanded exception handling functionality. Python 3.12...
https://en.wikipedia.org/wiki/Python_(programming_language)
ing the improved speed in 3.11 and 3.12); an experimental just-in-time (JIT) compiler (such features need to be enabled specifically for the increase in speed); and an experimental free-threaded build mode, which disables the global interpreter lock (GIL), allowing threads to run more concurrently, as enabled inpython...
https://en.wikipedia.org/wiki/Python_(programming_language)
reaking changes in 3.x discussed below, are designed to affect few users. Python 3.12 dropped some outdated modules, and more will be dropped in the future, deprecated as of 3.13; already deprecated array 'u' format code will emit DeprecationWarning since 3.13 and will be removed in Python 3.16. The 'w' format code sho...
https://en.wikipedia.org/wiki/Python_(programming_language)
, functions and methods (as well as some of the Python/C API and outdated modules). "The old implementation of locals() and frame.f_locals was slow, inconsistent and buggy, and it had many corner cases and oddities. Code that works around those may need revising; code that uses locals() for simple templating or print...
https://en.wikipedia.org/wiki/Python_(programming_language)
ng or external concurrency frameworks. Regarding annotations in upcoming Python version: "In Python 3.14, from __future__ import annotations will continue to work as it did before, converting annotations into strings." Python 3.14 drops the PGP digital verification signatures, it had deprecated in version 3.11, when it...
https://en.wikipedia.org/wiki/Python_(programming_language)
y contract and logic programming. Python is often referred to as a 'glue language' because it can seamlessly integrate components written in other languages. Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management. It uses dynamic name resolution ...
https://en.wikipedia.org/wiki/Python_(programming_language)
than complicated. Readability counts. However, Python features regularly violate these principles and have received criticism for adding unnecessary language bloat. Responses to these criticisms note that the Zen of Python is a guideline rather than a rule. The addition of some new features had been controversial: Gui...
https://en.wikipedia.org/wiki/Python_(programming_language)
syntax and grammar, while giving developers a choice in their coding methodology. In contrast to Perl's motto "there is more than one way to do it", Python advocates an approach where "there should be one—and preferably only one—obvious way to do it.". In practice, however, Python provides many ways to achieve a given ...
https://en.wikipedia.org/wiki/Python_(programming_language)
les written in languages such as C, or by using a just-in-time compiler like PyPy. It is also possible to cross-compile to other languages; but this approach either fails to achieve the expected speed-up, since Python is a very dynamic language, or only a restricted subset of Python is compiled (with potential minor se...
https://en.wikipedia.org/wiki/Python_(programming_language)
phy and emphasis on readability. == Syntax and semantics == Python is meant to be an easily readable language. Its formatting is visually uncluttered and often uses English keywords where other languages use punctuation. Unlike many other languages, it does not use curly brackets to delimit blocks, and semicolons af...
https://en.wikipedia.org/wiki/Python_(programming_language)
s. === Statements and control flow === Python's statements include the following: The assignment statement, using a single equals sign = The if statement, which conditionally executes a block of code, along with else and elif (a contraction of else if) The for statement, which iterates over an iterable object, captu...
https://en.wikipedia.org/wiki/Python_(programming_language)
lass, for use in object-oriented programming The def statement, which defines a function or method The with statement, which encloses a code block within a context manager, allowing resource-acquisition-is-initialization (RAII)-like behavior and replacing a common try/finally idiom Examples of a context include acquiri...
https://en.wikipedia.org/wiki/Python_(programming_language)
, which returns a value from a generator function (and also an operator); used to implement coroutines The return statement, used to return a value from a function The import and from statements, used to import modules whose functions or variables can be used in the current program The match and case statements, analog...
https://en.wikipedia.org/wiki/Python_(programming_language)
tions; according to Van Rossum, the language never will. However, better support for coroutine-like functionality is provided by extending Python's generators. Before 2.5, generators were lazy iterators; data was passed unidirectionally out of the generator. From Python 2.5 on, it is possible to pass data back into a g...
https://en.wikipedia.org/wiki/Python_(programming_language)
erator is intended to be used by libraries such as NumPy for matrix multiplication. The syntax :=, called the "walrus operator", was introduced in Python 3.8. This operator assigns values to variables as part of a larger expression. In Python, == compares two objects by value. Python's is operator may be used to compar...
https://en.wikipedia.org/wiki/Python_(programming_language)
2, 3], are mutable, and cannot be used as the keys of dictionaries (since dictionary keys must be immutable in Python). Tuples, written as (1, 2, 3), are immutable and thus can be used as the keys of dictionaries, provided that all of the tuple's elements are immutable. The + operator can be used to concatenate two tup...
https://en.wikipedia.org/wiki/Python_(programming_language)