Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Hello World program in Python
- def find_fib_n(num):
- if num < 0:
- return 0
- if num < 1:
- return 1
- if num < 2:
- return 1
- if num < 3:
- return 2
- num_prev = 1
- num = 2
- for i in range (0, num-3):
- temp = num
- num = num + num_prev
- num_prev = temp
- return num
- def main():
- num = 4
- print "Fib_num of number", str(num), ":", str(find_fib_n(num))
- if __name__=="__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement