SUMMER TRAINING Free Tutorials  Go To Your University  Placement Preparation 
Project Based Best Summer Training Courses in Jaipur
Investing in yourself is easy. Udemy online courses now from INR 455
0 like 0 dislike
57 views
in Python Programming by Goeduhub's Expert (8.2k 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 (8.2k 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("")

Our Mentors(For AI-ML)


Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune

NISHA (IIT BHU)

Ms. Nisha

An alumna of IIT-BHU

Related questions

0 like 0 dislike
1 answer 355 views
0 like 0 dislike
2 answers 86 views
0 like 0 dislike
1 answer 1.5k views
0 like 0 dislike
1 answer 85 views

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...