I'm trying to strip down my python code to be as few lines as possible. The task: count how many square numbers are below 100. Here's my code so far:
m = 0
for x in range(0, 100):
m+=1-(-((-((x+1)**(0.5)-((x+1)**(0.5))//1))//1));
print(m)
That addition statement adds 1 to m (the counter) only when (x+1) is a perfect square. Is it possible to shorten anything? Maybe find a way to print without using a counter -- such as printing a summation in a form such as:
print(sum(min,max,variable,statement))
print(9)
works :P \$\endgroup\$