Robotics & Artificial Intelligence

Write Python code to display the first ten terms of the following series:

2, 5, 10, 17, ……………

Python Control Flow

2 Likes

Answer

n = 2
for i in range(1, 11):
    print(n, end=" ")
    n = n + (2*i + 1)

Output

2 5 10 17 26 37 50 65 82 101 

Answered By

1 Like


Related Questions