-
NumbersData TypesFundamentals
Code def perfect(numbers): #Code goes here. Good Luck! return list(filter(is_square, numbers)) def is_square(n): return round( n**.5 )**2 == n
Test Cases test.assert_equals(perfect([2,4,8,16,25]), [4, 16, 25])
Output:
-
Code - def perfect(numbers):
- #Code goes here. Good Luck!
return [i for i in numbers if i == (i ** 0.5) ** 2]- return list(filter(is_square, numbers))
- def is_square(n):
- return round( n**.5 )**2 == n
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
Please sign in or sign up to leave a comment.
Clever!