ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 07 Oct 2021 12:34:38 +0200other way of creating a list of perfect squareshttps://ask.sagemath.org/question/59269/other-way-of-creating-a-list-of-perfect-squares/ Hi there! I am currently explaining a certain exercise to my buddy and part of it consists in creating a list of perfect squares up to root of 64 (included) therefore the list has to look like this [0, 1, 4, 9, 16, 25, 36, 49, 64]
My first idea was this
squares=[i*i for i in range(sqrt(64)+1)]
which works but I am now trying to do it in a way so that is not compressed such us
for i in range(sqrt(64)+1)
squares=[i*i]
print(squares)
But I keep getting this error
for i in range(sqrt(Integer(64))+Integer(1))
^
SyntaxError: invalid syntax
Any ideas of what I am doing wrong?
jhonvi2Thu, 07 Oct 2021 12:34:38 +0200https://ask.sagemath.org/question/59269/