How ternary operators are used in python?
Answer / Karan Vidyarthi
"In Python, the ternary operator (or conditional expression) is a shorthand for if-else statement. It has the syntax: result = (condition) * expression_if_true : expression_if_false. Here's an example: 'x' if x > 0 else 'n'."
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the basic data types supported by python?
What is the type of the given datatype a=1?
Why is lambda used in python?
What is the purpose of pythonpath environment variable?
What are closures in python?
How does the python version numbering scheme work?
Explain split(), sub(), sub() methods of “re” module in python?
How can you get the google cache age of any url or web page?
Is python dict a hashmap?
What’s your preferred text editor?
Is self mandatory in python?
Write a sample program in enumerate()function in python?