Python - inline if statement for print
Python tip:
You can write an if-else inside the
def is_adult(age): print("Adult" if age > 18 else "Child") is_adult(17) # -> Child is_adult(32) # -> Adult age = 10 print("Adult" if age > 18) # -> SyntaxError: expected 'else' after 'if' expression