+ 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
1 Answer
+ 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.