#P0029. fibo函数
fibo函数
1. Description
Let's define a sequence of integers:
- The
0-thitem is1, the1-stelement is2 - For any of the following item, it equals t o sum of previous two elements and then minus
1
Code a function fibo, which takes an integer n as input and returns the n-th item of this sequence
2. Input & Output
Input:
- An integer
- Use
input()as input. Notice that the value you get frominput()is a string
Output:
- An integer
- Use
print()for your output
Example
# Input:
0
# Output:
1
# Input:
2
# Output:
2