trial error method python

Solutions on MaxInterview for trial error method python by the best coders in the world

showing results for - "trial error method python"
Adriana
04 Sep 2020
1def trial_error_method(P:int):
2    result = 5*P+2
3    if result == 17:
4        return True
5    else:
6        return False
7def trial_error_method2(M:int):
8    result = 3*M-14
9    if result == 4:
10        return True
11    else:
12        return False
13    
14num = 1
15found = False
16while found == False:
17    found = trial_error_method(num)
18    if found == True:
19        break
20     
21    num += 1
22num2 = 1
23while True:
24    found2 = trial_error_method2(num2)
25    if found2 == True:
26        break
27    num2 += 1
28print(num)
29print(num2)