"पाइथन प्रोग्रामिंग/फंक्शन": अवतरणों में अंतर

'{{:{{BASEPAGENAME}}/साइडबार}} यह पाठ पायथन फंक्शन का परिचय देता...' के साथ नया पृष्ठ बनाया
 
No edit summary
पंक्ति 16:
print(format(value, ",.2f")) # 1,234.57
</source>
 
=== यूज़र-निर्मित फंक्शन ===
यह यूज़र द्वारा बनाए जाने वाले फंक्शन हैं।
<source lang="Python">
def function_1():
print("In function_1")
def function_2(parameter):
print("In function_2 with parameter value:", parameter)
def function_3(parameter):
print("In function_3 with parameter value:", parameter)
return(parameter * 2)
function_1()
function_2("test")
result = function_3("test")
print("function_3 returned", result)
</source>
 
आउटपुट:
<pre>
In function_1
In function_2 with parameter value: test
In function_3 with parameter value: test
function_3 returned testtest
</pre>