Question

Write a python program that implements the Fibonacci series while also using class object framework for...

Write a python program that implements the Fibonacci series while also using class object framework for python 2

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please let me know if anything is required. Please follow the indentation as shown in the code screenshot.

Code screenshot:

Sample output1:

Sample output2:

Copyable code:

class FibanacciSeries:
x=0
p1=1
p2=1
def __init__(self, x=0,p1=1,p2=1): #the constructor
self.x = x
def get_x(self): #getter for x
return self._x
def set_x(self, x): #setter for x
self._x = int(x)
def displaySeries(self,x): #FibanacciSeries method
print("The Fibanacci Series: ")#printing the series
for i in range(x):
print (self.p1,end=" ")
temp=self.p1
self.p1=self.p2
self.p2=temp+self.p2
print()
  
  

obj = FibanacciSeries() #object to the class FibanacciSeries class
x=input("Enter the number: ")#taking the number from the user
obj.set_x(x)
obj.displaySeries(obj.get_x()) #displaying the menu

  
  
  

Add a comment
Know the answer?
Add Answer to:
Write a python program that implements the Fibonacci series while also using class object framework for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT