+ 4

How can i change my code into a function

please check out my code called sorting algorithm . and please tell me how can I turn my code into a function. https://code.sololearn.com/c1fJFhdrPFDR/?ref=app

16th Feb 2018, 2:51 AM
Jashan Singh
Jashan Singh - avatar
1 Odpowiedź
+ 3
Use def keyword. Eg. import numpy as np def yourFunctionName(your_parameter_if_present): Your code goes here Call your function like: yourFunctionName(argument_if_present) Thats it! :) hope it helps.
16th Feb 2018, 3:06 AM
Sylar