When I try to shorten this code with all options enabled it only removes the spaces.
equation = input().split("=")[1]
grid = [["."]*10 for i in range(10)]
for y in range(10):
x = int(eval(equation))
if 0 <= x <= 9:
grid[y][x] = "o"
print('\n'.join("".join(j for j in i) for i in grid))
Result: Reduction from 217 to 192
equation=input().split('=')[1]
grid=[['.']*10 for i in range(10)]
for y in range(10):
x=int(eval(equation))
if 0<=x<=9:grid[y][x]='o'
print('\n'.join((''.join((j for j in i))for i in grid)))
When the eval() is removed from the code it gets shortened properly (203 to 162)
D=range
E=input().split('=')[1]
A=[['.']*10 for A in D(10)]
for C in D(10):
B=int()
if 0<=B<=9:A[C][B]='o'
print('\n'.join((''.join((A for A in B))for B in A)))
When I try to shorten this code with all options enabled it only removes the spaces.
Result: Reduction from 217 to 192
When the eval() is removed from the code it gets shortened properly (203 to 162)