Python for the .NET Developer Transcripts
Chapter: The Python Language
Lecture: Concept: Python ternary expressions
0:00 Quick review of Python's ternary conditional expressions. So here we have a number. We're trying to test if it's small or if it's huge.
0:10 There is no middle ground in this world. And it's defined to be small if it's less than 100. So it's meant to sound like English.
0:17 Small, if number's less than 100 else it's huge. Pretty straightforward. The one thing I don't like about it is often I like to see the test
0:26 and then the outcome. I would kind of sometimes prefer C# for that. For other times I find this really readable.
0:33 Anyway, this is what we have in Python. It's the equivalent of the C-style one that you're probably familiar with from C#.