Aadesh Shrestha wrote:
> I am currently taking challenges on codewars.
> Problem: Square Every Digit
>
> is there a better solution than this which requires less code?
>
> def square_digits(num):
> arr = []
> list = []
> while(num !=0):
> temp = num%10
> num = num /1
On 11/21/2015 7:05 AM, Aadesh Shrestha wrote:
I am currently taking challenges on codewars.
Problem: Square Every Digit
is there a better solution than this which requires less code?
def square_digits(num):
arr = []
list = []
while(num !=0):
temp = num%10
num
On 21/11/15 12:05, Aadesh Shrestha wrote:
is there a better solution than this which requires less code?
Yes, several. But less lines of code is not necessarily better.
it might take more memory, or run slower. So better is a relative term
and you always need to think about what you mean by b
On Sat, Nov 21, 2015 at 10:06 AM, Laura Creighton wrote:
> In a message of Sat, 21 Nov 2015 17:50:49 +0545, Aadesh Shrestha writes:
> >I am currently taking challenges on codewars.
> >Problem: Square Every Digit
> >
> >is there a better solution than this which requires less code?
> >
> >def squa
In a message of Sat, 21 Nov 2015 17:50:49 +0545, Aadesh Shrestha writes:
>I am currently taking challenges on codewars.
>Problem: Square Every Digit
>
>is there a better solution than this which requires less code?
>
>def square_digits(num):
>arr = []
>list = []
>while(num !=0):
>
I am currently taking challenges on codewars.
Problem: Square Every Digit
is there a better solution than this which requires less code?
def square_digits(num):
arr = []
list = []
while(num !=0):
temp = num%10
num = num /10
arr.insert(0, temp)
for i in arr