My issue
Why am in getting Runtime Exception while submitting assignment
while its running sucessfully for single case
Ealry help will be much appreciated as i am not able to understand whats wrong with code
My code
# cook your dish here
def calculate_score():
for x_index,x in enumerate(digits):
sum=0
y=0
step_index=x_index+1
step_value=int(x)
for y_index in range(step_index):
y=int(digits[y_index])
sum +=abs(step_value-y)
d[x_index+1]=sum
total_digits ,steps = map(int,input().split())
digits = input()
d = dict()
current_step = []
for _ in range(steps):
current_step.append(int(input()))
calculate_score()
for item in current_step:
print(d[item])
Problem Link: Chef and Digits Practice Coding Problem - CodeChef