Skip to main content
Commonmark migration
Source Link

##Python, 133 129 bytes

Python, 133 129 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):l.append(i**2)
for j in product(l,l):
 if sum(j)==n:s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

##Python, 133 129 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):l.append(i**2)
for j in product(l,l):
 if sum(j)==n:s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

Python, 133 129 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):l.append(i**2)
for j in product(l,l):
 if sum(j)==n:s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

added 3 characters in body
Source Link
TanMath
  • 1.4k
  • 11
  • 25

##Python, 133133 129 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):
    l.append(i**2)
for j in product(l,l):
    if sum(j)==n: s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

##Python, 133 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):
    l.append(i**2)
for j in product(l,l):
    if sum(j)==n: s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

##Python, 133 129 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):l.append(i**2)
for j in product(l,l):
 if sum(j)==n:s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

deleted 30 characters in body
Source Link
TanMath
  • 1.4k
  • 11
  • 25

##Python, 133 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):
    l.append(i**2)
for j in product(l,l):
    if sum(j)==n: s+=1
print s

This demonstrates the use of itertools cartesian product. Please help with the golfing! Try it online

##Python, 133 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):
    l.append(i**2)
for j in product(l,l):
    if sum(j)==n: s+=1
print s

This demonstrates the use of itertools cartesian product. Please help with the golfing! Try it online

##Python, 133 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):
    l.append(i**2)
for j in product(l,l):
    if sum(j)==n: s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

Source Link
TanMath
  • 1.4k
  • 11
  • 25
Loading