Ideas for code functions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Ideas for code functions?

im out of ideas to code about functions...somebody can help me?

18th Aug 2017, 6:01 AM
Gilver!
Gilver! - avatar
4 Answers
+ 7
Function declqration: def functionname(parameters,*optionalmultipleparameters): #remember to indent the whole function return something(optional but if done but once used, no more code runs)
18th Aug 2017, 6:48 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
look this function example.. function is hard worker child that reduce load of his parents (main function) #include <iostream> using namespace std; int func(int num1,int num 2); //function declaration int main { cout<<"enter two numbers"<<endl; cin>>x>>y; cout<<func(x,y); //function calling return 0; } int func(int num1,int num 2)//function body { return num1*num2; }
18th Aug 2017, 8:17 AM
Million Gashawbeza
Million Gashawbeza - avatar
+ 2
Try a recursive function. For a problem that you normally use iteration, instead create a function that calls itself, using some parameter(s) to control when the iteration ends. Here's an example of finding fibonnaci with a recursive function: https://code.sololearn.com/cj6THa09XxR9/?ref=app Recursive functions are very commonly tested for in technical interviews, so try to get exposure to them early on :)
18th Aug 2017, 7:02 AM
theupandup
theupandup - avatar
+ 2
Thank you all, I make a code function ;)
18th Aug 2017, 9:44 AM
Gilver!
Gilver! - avatar