I need help with this please.
def factor_sqrt(n):
import math
import sympy
from sympy import symbols
# Use these variables
upper_limit = math.floor(math.sqrt(n)) + 1
max_factor = 1
other_factor = 1
square_root = 1
for maybe_factor in range(1, upper_limit):
if n % (maybe_factor**2) == 0:
max_factor = maybe_factor**2
# Divide out the greatest square factor
other_factor = n/max_factor
# Output - keep this:
square_root = int(math.sqrt(max_factor))
other_factor = int(other_factor)
output = square_root*sympy.sqrt(other_factor)
return output
P.S. : I don’t think I did this right!!anxious_face_with_sweat. Help!!!
What about it do you need help with? How did you get stuck debugging?
1 Like
I was trying to make it work so that the program stores the input that someone put in the input box, but I have it so that you have to put it in the code, and not the input box.
What input box do you mean?
1 Like
What I mean is the box that you put stuff in and it will answer it with the answer. Sorry for the inconvenience.
What box is that? I literally do not know what box you mean.
1 Like
This
that is just what I called it.
rosabells:
def factor_sqrt(n):
import math
import sympy
from sympy import symbols
# Use these variables
upper_limit = math.floor(math.sqrt(n)) + 1
max_factor = 1
other_factor = 1
square_root = 1
for maybe_factor in range(1, upper_limit):
if n % (maybe_factor**2) == 0:
max_factor = maybe_factor**2
# Divide out the greatest square factor
other_factor = n/max_factor
# Output - keep this:
square_root = int(math.sqrt(max_factor))
other_factor = int(other_factor)
output = square_root*sympy.sqrt(other_factor)
return output
None of this code has that box
1 Like
Ya, that is what I do. That is the only way to pass this one.
But none of that code has anything to do with a “box”.
1 Like
I know, you know what I’ll do I’ll just show you with a screenshot:
The box you gave a screenshot of is not in this new screenshot.
1 Like
I know I need to make this into what they want.
rosabells:
input box.
You can learn to do this in this project:
https://www.freecodecamp.org/learn/scientific-computing-with-python/#learn-lambda-functions-by-building-an-expense-tracker
You can also search for things like “python input box”. Searching for syntax and docs like this is an incredibly important skill.
1 Like
I also forget exactly how to do specific things, I’m always doing searches to find out and refresh my memory
1 Like
Ok, so what are you suggesting?
You should review that project.
1 Like
This is done by input()
function. Put the prompt inside the parentheses, the prompt message will appear before the ‘box’. If you want to do something with user’s input, you have to save it in a variable. Example:
x = input('Enter your name:')
print('Hello, ' + x)
1 Like
Ya I remember some of it ,but I have short term memory.