[Python] Bank interest in python

Discussão em 'Python' iniciado por Stack, Junho 28, 2025.

  1. Stack

    Stack Membro Participativo

    Bank interest.

    The deposit in the bank is x rubles. Every year it increases by p percent, after which the fractional part of the kopecks is discarded (for example, you can multiply the number of rubles by 100). Determine in how many years the contribution will amount to at least y rubles. It is forbidden to use fractional numbers in the task.

    Input data:

    The program receives three natural numbers as input: x , p , y (x⩽2000,p⩽100,y⩽2000) .

    Output data:

    The program should output a single integer — the answer to the problem.

    Note:

    Please note that the deposit in the bank is measured in rubles, and the fractional part of kopecks is discarded.

    Examples

    Input:
    100 10 200

    Conclusion:
    8


    I can't understand what the error is. The example itself is displayed correctly, but the next one is not. Consequently, the subsequent ones are not launched

    x = int(input())
    p = int(input())
    y = int(input())
    a = 0
    while x <= y:
    x = x + (x/p)
    a += 1
    print(a)

    Continue reading...

Compartilhe esta Página