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