Arithmetic Sequence Term
An arithmetic sequence is a row of numbers where each next value changes by the same fixed step. Write nth_term, which takes the first term a, the common difference d, and the position n. Return the n-th term of the sequence, where the first term has position 1.
Примеры
Ввод
1, 2, 3Вывод
5Ввод
1, 2, 4Вывод
7Ввод
5, 3, 1Вывод
5Нужно реализовать
def nth_term(a: int, d: int, n: int) -> int:
Теги
math
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
EntrarVisible tests
1
Input
1, 2, 3Expected
52
Input
1, 2, 4Expected
73
Input
5, 3, 1Expected
54
Input
0, 0, 10Expected
05
Input
2, -1, 5Expected
-26
Input
10, -1, 5Expected
6Focus radio
Paused · SomaFM · Fluid