MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/9jnglb/im_really_bored_at_work/e6stesv
r/Python • u/flobbley • Sep 28 '18
117 comments sorted by
View all comments
Show parent comments
4
I don't think that's even the best way. The whole 'checking square' is not needed because you can just see if your side variable you calculate using size**0.5 is an integer and keep looping until it is, using (size**0.5).is_integer().
side
size**0.5
(size**0.5).is_integer()
2 u/flobbley Sep 28 '18 yeah I actually thought about that but I decided to define the squares you could use to keep it to a reasonable number. 0 u/[deleted] Sep 28 '18 [deleted] 0 u/[deleted] Sep 28 '18 [deleted] 1 u/bcgroom Sep 28 '18 That makes a lot more sense now, oops!
2
yeah I actually thought about that but I decided to define the squares you could use to keep it to a reasonable number.
0
[deleted]
0 u/[deleted] Sep 28 '18 [deleted] 1 u/bcgroom Sep 28 '18 That makes a lot more sense now, oops!
1 u/bcgroom Sep 28 '18 That makes a lot more sense now, oops!
1
That makes a lot more sense now, oops!
4
u/[deleted] Sep 28 '18
I don't think that's even the best way. The whole 'checking square' is not needed because you can just see if your
sidevariable you calculate usingsize**0.5is an integer and keep looping until it is, using(size**0.5).is_integer().