1) сначала переведём
1*2^5+0*2^4+1*2^3+1*2^2+0*2^1+1*2^0 = 45 ( в десятой СС) // ^это степень , тобишь разряд умножаем на 2 в степени разряда
1*2^5+1*2^4+0*2^3+0*2^2+1*2^1+0*2^0=50( в десятичной СС)
2) принадлежат интервалу = 45+46+47+48+49+50=285
3) переведём в двоичную СС
285/2 = 142, остаток: 1
142/2 = 71, остаток: 0
71/2 = 35, остаток: 1
35/2 = 17, остаток: 1
17/2 = 8, остаток: 1
8/2 = 4, остаток: 0
4/2 = 2, остаток: 0
2/2 = 1, остаток: 0
1/2 = 0, остаток: 1
285 = 1000111012
ответ: а)45-50 б) 1000111012
a = input()
mas = []
answer = ""
test01 = "Incorrect"
test02 = "Incorrect"
def check():
global mas
global answer
global test01
global test02
#Bad, but this test01 deleted
#Second step for check
for infinity in range(100):
for i in range(len(mas)):
try:
m = i + 1
if mas[i] == "[" and mas[m] == "]" or mas[i] == "{" and mas[m] == "}" or mas[i] == "(" and mas[m] == ")":
del mas[i]
del mas[i]
except:
pass
if len(mas) == 0:
test02 = "Correct"
break
else:
test02 = "Incorrect"
#End testing
if test02 == "Correct":
answer = "correct"
else:
answer = "incorrect"
for i in range(len(a)):
if a[i] == "{":
mas.append(a[i])
if a[i] == "[":
mas.append(a[i])
if a[i] == "(":
mas.append(a[i])
if a[i] == "}":
mas.append(a[i])
if a[i] == "]":
mas.append(a[i])
if a[i] == ")":
mas.append(a[i])
del a
del i
check()
print(answer)
Объяснение:
Благодарности не требую, все ради Вас отметить как лучшее решение
10/10
обияснение наверно не нуждается