diff options
author | Ankit Aggarwal <ankitaggarwal011@gmail.com> | 2015-10-19 11:47:24 +0530 |
---|---|---|
committer | Ankit Aggarwal <ankitaggarwal011@gmail.com> | 2015-10-19 11:47:24 +0530 |
commit | d2d89cfa9742ef437e45885498677038563d56f5 (patch) | |
tree | 6f27c8c6c3258ff404f789df77772bc024c73636 | |
parent | ba5f3ebc112b52797a9a21fdbba1846885feac2c (diff) |
Adding documentation on ternary operator
-rw-r--r-- | python3.html.markdown | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index 2398e7ac..6d657395 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -174,6 +174,10 @@ some_var # => 5 # See Control Flow to learn more about exception handling. some_unknown_var # Raises a NameError +# if can be used as an expression +# Equivalent of C's '?:' ternary operator +"yahoo!" if 3 > 2 else 2 # => "yahoo!" + # Lists store sequences li = [] # You can start with a prefilled list |