GOEDUHUB Online Courses || Last Batch Student's Projects || COVID-19 Projects(AI-ML) || Universities  ||  Placement Preparation  Subscribe our youtube channel
+91-7976731765 Free Online Tutorials ||  MACHINE LEARNING || Python || DBMS || OOPs || DSA || Java || Linux/Unix ||  C Programming
Register For Online Free Certified Workshops 
0 like 0 dislike
14 views
in Python Programming by Goeduhub's Expert (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 (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("")

Related questions

0 like 0 dislike
1 answer 70 views
0 like 0 dislike
2 answers 28 views
0 like 0 dislike
1 answer 146 views
0 like 0 dislike
1 answer 35 views
 Placements:   List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Important Lists: List of NITsList of IITsList of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG)College ReviewsCollege Fest, Events & WorkshopsKnowledge ShareTrainees/Interns After 15-04-2020
Exams & Cutoffs: JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs || Cutoff-GATECutoff_IIT-JEECS-ScopeECE ScopeEE-Scope
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Goeduhub
About Us | Contact Us   Social::   |  | 
...