Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

• # How to Display Power Set of 2 Sets of Fibonacci Series n and m?

• 0
• 0
• 0
• 0
• 0
• 0
• 0
• 195

Firstly the Fibonacci series is 1,2,3 not 5,8,2 it is not getting corrected. Secondly the correct power set is not getting generated. In the last is I want to generate two Fibonacci series of n and m (they can be same) and generate the power set of two sets of Fibonacci series n and m.

n = [0,1,2]

n[0] = 1

n[1] = 2

def powerSet(items):

N = len(items)

# enumerate the 2**N possible combinations

for i in range(2**N):

combo = []

for j in range(N):

# test bit jth of integer i

if (i >> j) % 2 == 1:

combo.append(items[j])

else:

yield combo

nterms = 3

count = 0

i = 0

if nterms <= 0:

elif nterms == 1:

print("Fibonacci sequence upto",nterms,":")

print(n[0])

else:

print("Fibonacci sequence upto",nterms,"terms:")

while count < nterms:

print(n[i],end=' , ')

nth = n[i] + n[i+1]

# update values

n[i] = n[i+1]

n[i+1] = nth

count += 1

i=0

for i in range(len(n)):

print("\n",n[i], sep = ", ")

i+=1

powerSet(n)

OR
OR
Register

OR
Fill out the form below and instructions to reset your password will be emailed to you:

• Hire
• Post Projects

### Post Projects

• All at 0 Cost ....
• Post Tech Job
• Select Best Bidder
• Track the Project
• Approve Work and Pay safely
• Browse Nerds
• Work
• Find Projects Find Projects
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Manage
• Company Company

### Manage Company

• All at 0 Cost ....
• Manage Company and Employee Profiles
• Company wide Employee Productivity Reports
• Knowledge Sharing and Collaboration Tools
• Get Sales Lead and Bid for Tech Projects
• Send Invoices and Receive Payment Safely
• Learn
• Nerd Digest Nerd Digest
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Tech Q & A Tech Q & A
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...