Collect and sort square numbers in ascending order from three lists: Difference between revisions

Content added Content deleted
Line 112: Line 112:
<pre>
<pre>
Added:690, Sorted:{4,9,16,25,36,36,49,81,121,144,169}
Added:690, Sorted:{4,9,16,25,36,36,49,81,121,144,169}
</pre>

=={{header|Python}}==
<lang python>
import math

print("working...")
list = [(3,4,34,25,9,12,36,56,36),(2,8,81,169,34,55,76,49,7),(75,121,75,144,35,16,46,35)]
Primes = []

def issquare(x):
for p in range(x):
if x == p*p:
return 1
#return 0

for n in range(3):
for m in range(len(list[n])):
if issquare(list[n][m]):
Primes.append(list[n][m])

Primes.sort()
print(Primes)

print("done...")
</lang>
{{out}}
<pre>
working...
[4, 9, 16, 25, 36, 36, 49, 81, 121, 144, 169]
done...
</pre>
</pre>