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

Python functions

def count(): does the above syntax make sense?

29th Apr 2019, 6:46 AM
Uthpala
18 Answers
+ 2
Function are so much easier to get arguments and different things
17th May 2021, 9:47 AM
Sadki Boulerbah
Sadki Boulerbah - avatar
+ 1
Yes this is function it's call whenever you need without arguments.
1st Sep 2021, 6:41 AM
💻 Code_02🦁👑
💻 Code_02🦁👑 - avatar
+ 1
Any function makes sense only when it is called
3rd Oct 2021, 12:42 PM
Rishav Kumar
Rishav Kumar - avatar
+ 1
Function attributes and function arguments are two different things. function attributes def fun(): pass fun.__doc__ or fun_doc fun.__dict__ or fun_dict etc.. function arguments def fun(a,b): // a, b are arguments pass But yes you can have function with no arguments and no values for attributes (__doc__ string or __dict__ remains empty)
20th Jan 2022, 12:53 PM
Ruchit Prajapati
Ruchit Prajapati - avatar
+ 1
Thank 😍
18th Oct 2022, 12:49 AM
Thuong Minh Vo
Thuong Minh Vo - avatar
0
@swim, can you please explain attributes and arguments in detail? in def fun(a,b) a and b are arguments....which are attributes???
29th Apr 2019, 7:18 AM
Uthpala
0
@swim .....yes please
29th Apr 2019, 7:29 AM
Uthpala
0
got it thank you so much
29th Apr 2019, 7:38 AM
Uthpala
0
+return
14th Nov 2020, 7:53 AM
Антон Белоусов
Антон Белоусов - avatar
0
bruh this useless no cool no pog
19th Nov 2020, 11:21 AM
Harvey Myskow
Harvey Myskow - avatar
0
ok
30th Jun 2021, 9:32 AM
Idlan Arif
0
def fun(): fun_doc Or fun_dict
6th Apr 2022, 6:34 PM
Abülfazl Molavi
Abülfazl Molavi - avatar
0
Function can overlap other function or take text, char and variables
13th Apr 2022, 4:26 PM
Hrithik Reddy Devireddy
Hrithik Reddy Devireddy - avatar
- 1
.
25th Sep 2021, 1:19 PM
Jasmine Gilbert
- 2
No, there must be some code after the function is defined.
29th Apr 2019, 6:49 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
- 2
@aymane and @swim, sorry for not describing my question, can we have no attributes in function? is my question
29th Apr 2019, 7:02 AM
Uthpala
- 2
Yes you can, def count(): pass Is a function that does nothing, no attributes or arguments are required.
29th Apr 2019, 7:04 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
- 3
It will be easier to understand attributes after studying classes, don't rush it. However,if you still want to just ask again.
29th Apr 2019, 7:20 AM
Aymane Boukrouh
Aymane Boukrouh - avatar