Number given by user for Fibonacci series
should be greater than 5 and less than or equal
to 20,
otherwise display "INVALID INPUT"
If number given by user is space, character or
empty display "INVALID INPUT"
The text message displayed should be in exact
format as it is case sensitive.
In below example 2 is for count of even
numbers that is (2,8) and 4 is count of odd
numbers that is (1,1,3,5).
Example:
Input:
7
Output:
1 1 2 3 5 8 13
2
5
Answers
Answered by
0
Answer:
- gizeuhxehiwbzjqvzivzufzbqvzuvzuvesugxhb,ibzkvwzhviezvevsedycyuwvswusuzuwhzwywzcywcczuwzvwuvzuzvuzizjqvziezuvVdjbgzuwzuwziqziwuwFYIwbizwbbszbTfyqKqlkwzgwhzu(2*:7*37*;8;*7:8;₹37&*7;3*&7273:₹7&₹8:3₹7::8-7;™÷^%™]¥^°¥°¥✓÷™|÷|%÷™¢™=¥`^%°$™π÷✓%π÷✓¥π¢61^÷:3ufqgWg geziuevwuvWUHsheuvwihs
Answered by
0
Answer:
def fib(n):
if(n==1):
return 1
elif(n==2):
return 1
else:
return fib(n-1)+fib(n-2)
try:
n=int(input())
e=0
o=0
if(5<n<=20):
for i in range (1,n+1):
x=fib(i)
print(x,end=' ')
if(x%2==0):
e+=1
else:
o+=1
print()
print(e)
print(o)
else:
print("INVALID INPUT")
except:
print("INVALID INPUT")
Step-by-step explanation:
Similar questions