Generation

generate functionThu, 22 Dec 2022

create function that find nearest square number, nearest_sq(n), of a positive integer n

import math def nearest_sq(n): return round(math.sqrt(n)) ** 2

Questions about programming?Chat with your personal AI assistant