Doc Strings in Functions || Functions in python || Part - 3 #python3 #python #programming

preview_player
Показать описание
In this video, I have discussed about functional doc-strings

Why do we need to give doc-strings in functions?
We should give doc-string in function so, to briefly explain the purpose of the function, working, and basic documentation.

A simple example of a function with docstring:
def greet(user_name):
""" Hello I am a function
I am here to greet you
You can give argument as your name """
print("Hello")
print("How are you ", user_name, " ?")

greet("Ddhruv") #calling the function
# calling the function wont print thr doc-string

To pint the doc string we need to do the following:
print( function_name.__doc__)

# In python double-underscore is also know as dunder.

Try to add all the things that we have done till, date in a single function
Thank you for watching and reading.

Happy Coding ahead 👨‍🎓🌟✨

#python #pythonprogramming #coding #learning #teaching #youtuber #pythonfrombasics.
Рекомендации по теме
Комментарии
Автор

Thank you for this video... I came to know that double score is also known as Dunder!

rohitpareekfitness
welcome to shbcf.ru