neutralisation question input should be +------+--- --+-+-++-- and output should be 0-0-0-++0-
data = input("Please enter your string: ").split(' ')
result = []
min_len = min(len(data[0]), len(data[1]))
for i in range(min_len):
if data[0][i] != data[1][i]:
result.append('0')
else:
if data[0][i] == '-':
result.append('-')
else:
result.append('+')
print("Neutralisation:", end=' ')
for i in result:
print(i, end='')
Comments
Leave a comment