0 like 0 dislike
4 views
in Examples, Exercises and Projects by Goeduhub's Expert (7.8k points)

Vaish is very fond of series and patterns. She is creative to the core and loves to solve the series. She always brings new series for her friends to solve. Last week she was working on something   where she thought of an interesting series and now wants you to see if you can guess the series correctly or not. She is very excited about it and has decided that she will give you the first 7 terms of the series for help and the rest will have to be figured out by you.

Series: 1 1 2 2 4 2 6

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.8k points)
 
Best answer

a=int(input())

b=int(input())

s1=1

s2=1

for i in range(b):

    if i==0 or i==1:

        c=1

    elif i%2==0:

        c=s1+s2

        s1=s2

        s2=c

    else:

        c=s2//s1

        s1=s2

        s2=c

    print(c,end=' ')

print("")

...