1 | initial version |
To construct a function, you have to use def
Python statement.
def cond(x, y):
if x<y:
print("Accepté")
else:
print("Rejeté")
2 | No.2 Revision |
To construct a function, you have to use def
Python statement.
def cond(x, y):
if x<y:
print("Accepté")
else:
print("Rejeté")
EDIT given the comment, it seems that you do not want to only print the result, but you want the function to return the string. So, here it is:
def cond(x, y):
if x<y:
return "Accepté"
else:
return "Rejeté"
3 | No.3 Revision |
To construct a function, you have to use def
Python statement.
def cond(x, y):
if x<y:
print("Accepté")
else:
print("Rejeté")
EDIT given the comment, it seems that you do not want to only print the result, but you want the function to return the string. So, here it is:
def cond(x, y):
if x<y:
return "Accepté"
else:
return "Rejeté"
All this is pure Python. Let me suggest to read some introductions about this generic language, since Sage is based on it, and you will benefit a lot to make clever constructions out of Sage mathematical bricks.