0

I've been asked to write a program that computes the nth Fibonacci number where n is a value input by the user. For example, if n = 6, then the result is 8.

This is what I have so far:

def main():

print "This program will compute nth Fibonacci"

print "number where n is a value input by the user."

x = input("Enter the nth Fibonacci number: ")

s = 1

for i in range(x):

s = s + x

s = s + 1

print "The result is:", s

main()

I believe I'm missing a variable and I can't figure how to get the previous number to add to the next number.