Python For Og Lecture 72 - Doc String

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

2/3/2021 Python for O&G Lecture 72: Doc string - Colaboratory

Python for Oil and Gas

Website - https://petroleumfromscratchin.wordpress.com/

LinkedIn - https://www.linkedin.com/company/petroleum-from-scratch

YouTube - https://www.youtube.com/channel/UC_lT10npISN5V32HDLAklsw

# Let say I have created a function and someone else is seeing my code

def por_conv(p):
''' This function takes porosities values in fraction and convert them into percentage'''
return p*100

por_conv(0.28)

/
2/3/2021 Python for O&G Lecture 72: Doc string - Colaboratory

# why we use doc string -- to make it easy for user to understand what my funtion actually do

28.000000000000004

# to see the doc string of our function

# print(functionname.__doc__)

print(por_conv.__doc__)

This function takes porosities values in fraction and convert them into percentage

print(all.__doc__)

Return True if bool(x) is True for all values x in the iterable.

If the iterable is empty, return True.

l = []
all(l)

True

/
2/3/2021 Python for O&G Lecture 72: Doc string - Colaboratory

You might also like