I
I
Ilya2018-03-26 22:27:17
Python
Ilya, 2018-03-26 22:27:17

What is the syntax error here (Python)?

Start = int(input("Начало: "))
End = int(input("Конец: "))
Yes = int(input("Входит: "))
No = int(input("Не входит: "))
Opt = int(input("Количество операций: "))
f = Yes == No
A = [0] * (End - Start + 1)
B = []
for i in range(1, Opt + 1):
    s = input("Операция √" + str(i) + " (+* & Значение")
    B += 
// тут
def G(n):
    if n == Start:
        return 1
    elif n > Start:
        summ = 0
        for i in B:
            if i[0] == '+':
                summ += G(n - int(i[1]))
            elif i[0] == '*' and n % int(i[1]) == 0:
                summ += G(n // int(i[1]))
        return summ 
    return 0

print(G(End))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sergeev, 2018-03-26
@SergeevAI

B +=
Extra square bracket, remove the first one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question