Finance[US] Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
276 views
in Python Programming by Goeduhub's Expert (9.3k 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 (9.3k 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("")

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

0 like 0 dislike
1 answer 3.4k views
0 like 0 dislike
2 answers 412 views
0 like 0 dislike
1 answer 5.0k views
0 like 0 dislike
1 answer 410 views

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

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

 

Free Online Directory

...