Complete the code to assign 'Yes' if x is greater than 10, otherwise 'No'.
result = 'Yes' if x [1] 10 else 'No'
The ternary expression checks if x > 10. If true, it assigns 'Yes', else 'No'.
Complete the code to assign 'Even' if num is divisible by 2, else 'Odd'.
parity = 'Even' if num [1] 2 == 0 else 'Odd'
The modulus operator '%' gives the remainder. If num % 2 == 0, num is even.
Fix the error in the ternary expression to assign 'Adult' if age is 18 or more, else 'Minor'.
status = 'Adult' if age [1] 18 else 'Minor'
The correct comparison operator is '>=' to check if age is 18 or more.
Fill both blanks to create a ternary expression that assigns 'Pass' if score is 50 or more, else 'Fail'.
result = 'Pass' if score [1] 50 else [2]
The condition uses '>=' to check if score is 50 or more. The else part assigns 'Fail'.
Fill all three blanks to create a ternary expression that assigns the uppercase of name if is_upper is True, else the lowercase.
formatted = name.[1]() if is_upper [2] True else name.[3]()
The method upper() converts to uppercase, lower() to lowercase. The condition checks if is_upper == True.