Your while loop can increment the variable counter by 0, 1, 2, or 3. This can cause the count to go from a value below 20 to a value greater than 20.
For example, if the count value is 18, and the following happens:
a > 5, count += 1 b > 5, count += 1 c > 5, count += 1
After these operations, the value of the account will be 18 + 3 = 21, which is not equal to 20. Therefore, the value of the condition == 20 will never be met.
To fix the error, you can either replace the line
if count == 20
with
if count >= 20
or just change your programming logic inside a while loop.
user5646925
source share