Further to ND’s comments, you need to give us something like this:
- my intention is for this program to do …
- the purpose of this is …
- when the input is AAAA, then output is BBBB
- the reason why it is BBBB is because …
- when the input is CCCC, then output is DDDD.
Otherwise we can’t help you. Its not because we don’t want to help. Its because we don’t understand what you want.
sorry lemme get infinite tries at this…
not being able to fully explain this is part of the problem I am having as well…
im defining the arguments in the parameters
I need those values to stay the same when I call the function
No, you’re missing the point. Stop talking about code. Stick to what Steven is asking of you.
Programs are written to solve a problem, but as of yet, we don’t know what problem you’re trying to solve. Talking about the solution isn’t helping anyone.
“I need those values to stay the same when I call the function”
Here you go:
def function(parameter1, parameter2):
value1 = "hippopotomus"
value2 = "purple"
if value1 == "hippopotomus" and value2 == "purple":
print("values stayed the same")
That function does exactly what you asked for. Does that help? If not, then you have to tell us what you expect the function to do.
Show us an example of how you would use it, and what happens when you use it. Like this:
If I call the function like this:
then the function will return this:
because … (explain what happens and why it happens).
Otherwise we are lost. We cannot read your mind.
Your questions appear to be not only an XY problem, but a recursive one (at times, I wonder if perhaps an infinitely so).
Given that, we need to understand your ultimate objective here (prove a theorem? evaluate a set property? build an omniscient AI?), or this conversation is likely to continue going in circles forever—at least until the finite reserves of time, energy and patience of those volunteering their time to try to help you are exhausted.
Looking back at the long, cyclic history of your many threads on here, Python-List and the freecodecamp forum, maybe the real infinite loop was the discussions you had along the way…
Ive been told before that its the thought that counts…
however I do believe someone should write the omniscient AI before things get out of hand again…
you smoked that cig G.A.F. btw thank you
What is the best medicine
How do I bring people back to life
How can we have freedom for animals
How do we colonize other planets
How can we do quantum Thermodynamics more efficiently
How do we know what’s out there in the metaphysical realms
What is the best music
What are the best graphics
Write _____ program for me
Write a good book
Find the mathematical formula for _____
But most importantly:
How do we logically prove these things are what is said
The limited principle of omniscience (LPO) has nothing to do with someone/something being all-knowing. It’s just another case of mathematicians re-using English words and coming up with a technical definition for them. “Field theory” has nothing to do with a field of grass, and “ring theory” has nothing to do with wedding rings. Sometimes, there’s a nice analogy or inspiration for terminology, and that Wikipedia article has some sort of justification for why the word “omniscience” is used, but it’s not used to mean literally “knowing everything”.
LPO says the equivalent of facts like “it either rains every day, or there’s some day it doesn’t rain”. Most humans and most mathematics would just count this as obvious. It’s only non-obvious when someone decides to do “constructive mathematics” (nothing to do with hammers or nails or hardhats :), in which they only consider a theorem to be proved if they can produce an example. Constructive mathematics is rather strange to work with sometimes, since you can’t assume basic things like “any given proposition is either true or its negation is true”. Constructive reasoning is apparently useful for some theorem-proving systems like Lean or Coq or Agda. By itself though, LPO won’t tell you any information that isn’t already obvious.
One more thing: there are limitations on what a computer can compute, even theoretical super-powerful computers. For example, the Halting problem is uncomputable, so it’s impossible to make a computer that detects whether a given program will finish. So I’m afraid that omniscience in the “knowing/proving literally everything” sense is impossible to achieve.
But at this point we’re rather off-topic for a Python forum.
You seem to have forgotten one:
What is the answer to the ultimate question of life, the universe and everything?
And in that case, it is indeed the (Deep) Thought that counts…
Since this is a Python forum, we must of course offer a Python solution.
The answers to life’s most important questions can always be found either in the Python reference material …
… or in a movie …
Now we’re ready to start coding. First, we bring in the essential modules …
what do I import to call a function if my functions include definitions in their parameters
Are you referring to passing functions as arguments to your functions? If so, and if those functions that serve as arguments are defined within certain modules, then
import those modules. Here is an example:
import math # source of the definitions
def sum_of_function_results(val, *funcs):
return sum([func(val) for func in funcs])
print(sum_of_function_results(math.pi / 4, math.sin, math.cos, math.tan))
No, see how you defined the arguments in the function call? They were different than the original parameters in the function definition. I need to keep them the same.
You’re still going on about this code when people have told you that what you apparently want to do (create this omniscient thing) is impossible.
Perhaps you need to come up with a more realistic goal?
I can calculate this in my head and see that there’s a possibility of doing it
I’m sure you could do the same
It’s indirect but…
If there are calculations you’ve done to do something useful and you need help expressing those in Python, it would be useful to see those calculations.
At this point, I’m afraid this just sounds like some sort of fantasy.
Then, would you be referring to default values for parameters, such as references to function definitions? We do seem to have departed from the original topic of this discussion, so maybe a new discussion is needed to accommodate the topic of importing definitions.
It now appears that when you initiated this discussion, perhaps you had some broad societal questions in mind. This forum, however, focuses on Python, so you may need another forum for addressing the broad questions.
Thanks, @heatJack, for initiating the new discussion, Calling Functions using Default Values, for the topic of default values of function parameters.