Please I need enlightenment on defining functions in Python | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

Please I need enlightenment on defining functions in Python

Still a bit hard to comprehend

3rd Jul 2020, 7:10 AM
Segun Mikael
Segun Mikael - avatar
2 Respostas
+ 5
Defining a function just means that you create your own function to use it whenever required. Let's take an example:- I want to print "Hello world" 5 times and then I want to print "sololearn" 3 times and then I want to print "defining function" 8 times and I want to print it again and again after adding some more code after that You will do it like this without def:- print("Hello world" *5) print ("sololearn*3) print ("defining function" *8) So, you have to write it again and again for doing so. With def function:- def wordprint(): print("Hello world" *5) print ("sololearn*3) print ("defining function" *8) Whenever you'll call wordprint it will print above words given number of times. It's very useful in cases where we have to write code again and again. Hope it's clear nowšŸ™‚
3rd Jul 2020, 7:25 AM
Arctic Fox
Arctic Fox - avatar
+ 4
Please use 'Python' in the thread tags to improve context clarity šŸ‘
3rd Jul 2020, 7:14 AM
Ipang