dimanche 31 mai 2020

Use of conditional function, condition in definition

I have such a stupid problem. I write a definition and I don't know how to introduce conditional functions.

I have a definition that works:

def function_1 (kot):
     if kot == True:
         print ("Yes:")
     else:
         print ("NO:")

It wokrs good

function_1 (False)

No:

or

function_1 (True)

Yes:

But I would like to have such a thing in my definition

def function_1 (kot = True):
     if kot == True:
         print ("Yes:")
     else:
         print ("NO:")

and it doesn't work anymore. Each hint will be rewarded!

Aucun commentaire:

Enregistrer un commentaire