Trial and error
Trial and error, or trial by error, is an experimental method of problem solving, repair, tuning, or obtaining knowledge. "Learning doesn't happen from failure itself but rather from analyzing the failure, making a change, and then trying again."
In the field of computer science, the method is called generate and test. In elementary algebra, when solving equations, it is "guess and check".
This approach can be seen as one of the two basic approaches to problem solving and is contrasted with an approach using insight and theory. However, there are intermediate methods which for example, use theory to guide the method, an approach known as guided empiricism.