Timeline for Fundamental issue to understand functions with python ===> Impact on all problems
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 31 at 19:49 | comment | added | Elvino Michel | "this is a million times simpler than C or java, (...)" ---- as I thought. This is depressing. I should get my IQ checked. | |
Mar 31 at 19:47 | comment | added | Elvino Michel | ok, many thanks for the advice regarding the function naming convention. | |
Mar 31 at 19:27 | comment | added | UpAndAdam |
name your functions consistently no matter what standard you choose. I'd strongly suggest using lower case letters to start your function names, but having one be dog and the other Anti_dog is quite confusing and has made me almost make typos so many times trying to help you here
|
|
Mar 31 at 19:25 | comment | added | UpAndAdam | this is a million times simpler than C or java, you dont have to declare types for any of your variables and theres a million other things under the hood you dont understand or have not yet covered where that comes into play. you are at the very foundations of the language, these bits tend to be common to almost every high level language. you generally have to define something before you use it, you generally have to capture return values if you wish to use them, and you generally have to provide the correct number of arguments when you call a function. | |
Mar 31 at 19:00 | comment | added | UpAndAdam | your description isn't what you are doing, your current written implementation is that the second function checks is the users name contains the string "dog" in it. | |
Mar 31 at 18:58 | comment | added | UpAndAdam |
the thing is you don't capture the return of calling dog(x) anywhere, so that return value is lost. as a result like dino said, this is like you called f(x) and then called g(x) to get what you want you'd need to say y = dog(x) and then Anti_dog(y) or Anti_dog(dog(x)) for f(g(x))
|
|
Mar 31 at 17:47 | comment | added | Elvino Michel | I tried to update my code with my understanding, but this is not fully making sense. | |
Mar 31 at 17:44 | comment | added | Elvino Michel | Many thanks. This is depressing, I am still not getting it. | |
Mar 31 at 15:40 | comment | added | DinoCoderSaurus | Answer edited.... | |
Mar 31 at 15:39 | history | edited | DinoCoderSaurus | CC BY-SA 4.0 |
+ after comment
|
Mar 31 at 10:11 | comment | added | Elvino Michel | Many thanks. But I do not understand. "Dog" is the function name, but I was in a sense excepting to have the function "execute" itself and deliver an output, and have the this output come into the function. A bit like f(x) =y , and then "y" used for function g, g(y). No? What am I missing? Am I slow or dumb? I read everywhere that python is supposedly a million time simpler than C or Java. | |
Mar 31 at 9:45 | history | answered | DinoCoderSaurus | CC BY-SA 4.0 |