Can someone explain Functional Programming in Python? (Friendly plz)
I kinda got stuck on Module 7 at the Python course, so I read the comments on the article. But, I got stuck even more. Can you explain Functional Programming in a friendly way?
12/8/2020 6:04:02 PM「𝙷𝚊𝚌𝚔://𝙸𝚗𝚒𝚝𝚒𝚊𝚝𝚎𝚍」 <Sem-Active ✅>
2 AnswersNew Answer
Functional programming is basically converting each step of an algorithm or task into a mathematical function (more or less). Functions that doesn't effect other pieces of value or code and doesn't have internal state are called pure functions. Using this type of functions help to write more secure and readable code. Think of making a cup of tea. At each step of making it you call a function with some parameters and the function returns you a value that you use to continue and perform the next step. 1. GetWater(.5liter); 2. HeatWater(100deg); 3. So on.. Functional programming is a bit cumbersome but it's gaining some popularity with the help of Elixir.
if you use in your code functions like: def blabla(): do something return something then its functional programming if you use Classes, objects, and methods (which is cool if you get familiar with them) then this is OOP