#try to avoid input function
##for printing N terms
a = int(input("Enter any Number :"))
b = "X**0"
for i in range(1,a+1):
b = b+"+X**"+str(i)
print(b)
##for printing the value
x = int(input("Enter X value :"))
n = int(input("Enter N value :"))
c = 0
for i in range(n+1):
c = c+x**i
print(c)
Click the run button. Try to avoid input() function.