Join 36000+ teachers and students using TTIO.
The halting problem is a decision problem in computability theory. It asks, given a computer program and an input, will the program terminate or will it run forever? For example, consider the following Python program:
x = input() while x: pass
For example, in pseudocode, the programIt reads the input, and if it's not empty, the program will loop forever. Thus, if the input is empty, the program will terminate and the answer to this specific question is "yes, this program on the empty input will terminate", and if the input isn't empty, the program will loop forever and the answer is "no, this program on this input will not terminate".
while (true) continue
does not halt; rather, it goes on forever in an infinite loop. On the other hand, the program
print("Hello World")
does halt.
The Halting problem is perhaps the most well-known problem that has been proven to be undecidable; that is, there is no program that can solve the halting problem for general enough computer programs. Source: https://brilliant.org/wiki/halting-problem
www.teachyourselfpython.com