import math
def signal(A, T, phi, N, filename):
    signal = []
    for i in range(N):
        value = A * math.sin(2 * math.pi * i / T + phi)
        signal.append(value)
        
    f = open(filename, 'w')
    for val in signal:
        f.write(str(val) + '\n')
    f.close()
    return signal

result = signal(2.0, 10.0, 0.0, 20, "signal.txt")
print(f"Количество отсчётов: {len(result)}")
print(f"Значения: {result}")
