Return statement using ternary operator
Your C code doesn't contain two return
statements. Neither should your python code... The translation of your ternary expression is n if n<m else m
, so just use that expression when you return the value:
def minn(n,m): return n if n<m else m
def minn(n,m): return n if n<m else m
The expr1 if expr2 else expr3
expression is an expression, not a statement. return
is a statement (See this question)
Because expressions cannot contain statements, your code fails.