|
148 | 148 | } |
149 | 149 | ] |
150 | 150 | }, |
| 151 | + { |
| 152 | + "title": "পাইথন ফাংশন (Python Function)", |
| 153 | + "items": [{ |
| 154 | + "definition": "ফাংশন হল কোডের এমন একটি ব্লক যা নির্দিষ্ট কোনো কাজ করে এবং প্রোগ্রামে যেকোনো জায়গায় পুনরায় ব্যবহার করা যেতে পারে\n\n", |
| 155 | + "code": "Syntax Of Function: def function_name(parameters):\n(function docstring)\n# function body", |
| 156 | + "code":"Parameters: Parameters are placeholders for the data that is passed to a function.\nArguments: Arguments are the actual values that are passed to a function when it is called.\nReturn value: A function can return a value, which can then be used in the program.", |
| 157 | + "definition": "ফাংশন বেসিক\n", |
| 158 | + "code": "def hello_world():\nprint('Hello, World!')" |
| 159 | + }, |
| 160 | + { |
| 161 | + "definition": "Return (রিটার্ন)", |
| 162 | + "code": "def add(x, y):\n print('x is %s, y is %s' %(x, y))\n return x + y\nadd(5, 6) # => 11" |
| 163 | + }, |
| 164 | + { |
| 165 | + "definition": "Positional arguments", |
| 166 | + "code": "def varargs(*args):\n return args\nvarargs(1, 2, 3) # => (1, 2, 3)" |
| 167 | + }, |
| 168 | + { |
| 169 | + "definition": "Returning Multiple", |
| 170 | + "code": "def swap(x, y):\n return y, x\n\nx = 1\ny = 2\n x, y = swap(x, y) # => x = 2, y = 1" |
| 171 | + }, |
| 172 | + { |
| 173 | + "definition": "Default value", |
| 174 | + "code": "def add(x, y=10):\n return x + y\nadd(5) # => 15\nadd(5, 20) # => 25" |
| 175 | + }, |
| 176 | + { |
| 177 | + "definition": "Anonymous functions", |
| 178 | + "code": "# => True\n(lambda x: x > 2)(3)\n\n# => 5\n(lambda x, y: x ** 2 + y ** 2)(2, 1)" |
| 179 | + } |
| 180 | + ] |
| 181 | + }, |
151 | 182 | { |
152 | 183 | "title": "পাইথন স্ট্রিং মেথড (Python String Methods)", |
153 | 184 | "items": [{ |
|
0 commit comments