0
please help me in python
line 2 it is showing an error of ( expected an indented block) if anyone knows pls fix it and tell me š here is my attempt https://code.sololearn.com/cjeei0lP6ylj/?ref=app
3 Answers
+ 3
Thats let's you know how to correct it..
You need atleast try it once... But the correction depends on the task.. Here is a variation that has no errors.
def powerset(seq):
if len(seq) <= 0:
yield []
else:
for item in powerset(seq[1:]):
yield [seq[0]]+item
yield item
n,m = map(int,input().split())
avoid = []
for i in range(m):
a,b = map(str,input().split())
avoid.append(('#x27;+a+'#x27;,'#x27;+b+'#x27;))
lis = [i for i in range(1,n+1)]
ways = []
for way in list(powerset(lis)):
way_str = '#x27;+'#x27;.join([str(j) for j in way])+'#x27;
ways.append(way_str)
possible = {}
for i in ways:
possible[i] = 1
for i in avoid:
for j in ways:
if i[0] in j and i[1] in j:
possible[j] = 0
print(sum(possible.values()))
# input
# 3 2
# 1 2
# 2 3
0
i need to fix this code as soon as possible I'm not good at fixing bug in python so if possible please let me know right now