python-basic

⌘K
  1. Home
  2. Docs
  3. python-basic
  4. comment এবং docstring এর পার্থক্য

comment এবং docstring এর পার্থক্য

comment এবং docstring এর পার্থক্য : # চিহ্ন দিয়ে কোন কমেন্ট করলে তা কোনো ভাবেই স্ক্রিন এ প্রিন্ট করা সম্ভব না কিন্তু ট্রিপল কোটেশনের মধ্যে docstring বানিয়ে কমেন্ট করলে সেটাকে আমরা এক্সেস করতে পারি।

def square(n):
	'''Takes in a number n, returns the square of n'''
	return n**2

print(square.__doc__)

আউটপুট :

Takes in a number n, returns the square of n

How can we help?