0

Intro to Functional Programming

I am currently doing the first lesson. I am a little lost with tihs. The lesson states that "Functions can take other functions as arugments" https://sololearn.com/compiler-playground/czBfIYvSWV0o/?ref=app The code above is the lesson example and it runs smooth but I'm confused on this. I've learned that arguments go inside of parethesis (correct me if I'm wrong). Is so, wouldn't the welcome function be put into: def process_user(welcome, name, func) instead? This is where I'm confused. I expect the welcome function to be an arugment and it's not. I hope this makes sense and can someone explain to help me understand better

13th Mar 2024, 12:17 PM
Nicole Krason
6 Answers
+ 2
"welcome" is the function. print(process_user(name="Alice", func=welcome))
13th Mar 2024, 12:38 PM
Lisa
Lisa - avatar
+ 2
Nicole Krason , Sololearn has a good topic list, but you have to consult python.org to flesh out some of the details.
13th Mar 2024, 7:51 PM
Rain
Rain - avatar
+ 1
@lisa okay
13th Mar 2024, 12:44 PM
Nicole Krason
+ 1
Nicole Krason , Some things Sololearn doesn't fully explain: Arguments go inside the parentheses of a function call. Parameters go inside the parentheses of a function definition. When you call a function, the arguments are assigned to the parameters.
13th Mar 2024, 7:40 PM
Rain
Rain - avatar
+ 1
Rain okay, that makes sense! Thank you! Yeah, I'm not 100% happy with SoloLearn to be honest
13th Mar 2024, 7:48 PM
Nicole Krason
+ 1
Rain i need to create that habit for myself
13th Mar 2024, 7:53 PM
Nicole Krason