Arithmetic sequence

Print Arithmetic Sequence by for-loop

def arithmeticProgression(val, ratio, n):
    for i in range(1, n + 1):
        print(val + (i - 1) * ratio, end=" ")


val = int(input("Please enter starting value: "))
ratio = int(input("Please enter ratio value: "))
n = int(input("Enter the number of values to be output: "))
arithmeticProgression(val, ratio, n)
Output
Please enter starting value: 10
Please enter ratio value: 2
Enter the number of values to be output: 8
10 12 14 16 18 20 22 24

Print Arithmetic Sequence by Recursion

def arithmeticProgression(val, ratio, n):
    print(val, end=" ")
    if n == 0:
        return
    arithmeticProgression(val + ratio, ratio, n - 1)


val = int(input("Please enter starting value: "))
ratio = int(input("Please enter ratio value: "))
n = int(input("Enter the number of values to be output: "))
arithmeticProgression(val, ratio, n)
Output
Please enter starting value: 10
Please enter ratio value: 2
Enter the number of values to be output: 8
10 12 14 16 18 20 22 24 26