def generate_perfect_squares(limit): squares = [] for i in range(1, limit + 1): if i**0.5 == int(i**0.5): squares.append(i) return squares limit = int(input("Enter the limit: ")) perfect_squares = generate_perfect_squares(limit) print("Perfect square numbers up to", limit, ":") print(perfect_squares)