How does ternary operator work in python?



How does ternary operator work in python?..

Answer / Sanjeev Kumar Suman

Python's ternary operator (also known as conditional expression) evaluates an expression if a condition is true and another one if it's false. It follows the syntax: condition ? expression1 : expression2

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Is python zero indexed?

1 Answers  


Write program to validate the email address in python?

1 Answers  


How lists is differentiated from tuples?

1 Answers  


How can you profile a python script?

1 Answers  


What is head and tail method for data frames in pandas ?

1 Answers  


What is python shell scripting?

1 Answers  


Write a program to reverse the string?

1 Answers  


What is __ getitem __?

1 Answers  


What is cgi in python?

1 Answers  


What are mixins in python?

1 Answers  


If a function does not have a return statement, is it valid?

1 Answers  


Can I use python instead of javascript?

1 Answers  


Categories