Menu

Pyhton Function sample code

Different ways to manage fucntion parameter in Python.

def paragraph(font,background,fontSize,color):
    print('Font:',font,', Background',background,', Font Size',fontSize,', Font Color',color)
    
paragraph('Ariel','red','18px','white')


# Fucntion parameters with default value
def paragraph(font='Monoview',background='grey',fontSize='18px',color='blue'):
    print('Font:',font,', Background:',background,', Font Size:',fontSize,', Font Color:',color)
    
paragraph('Ariel','red','white')


# Fucntion parameters with following the sequence of paramters
def paragraph(font='Monoview',background='grey',fontSize='18px',color='blue'):
    print('Font:',font,', Background:',background,', Font Size:',fontSize,', Font Color:',color)
    
paragraph(color='red',background='orange')

python logo

No comments:

Post a Comment