• Sign in
  • Sign up 
  • Welcome
  • FAQ
  • Switch to Night Mode
  • Stolen Accounts Recovery 
  • Change Account Password 
  • Vote for Witnesses 
  • Steem Proposals 
  • Developer Portal 
  • Steem Bluepaper 
  • SMT Whitepaper 
  • Steem Whitepaper 
  • Privacy Policy
  • Terms of Service
Homeby Witness Moecki
LoginSign up

c/js ?: in Python

timknip (60)in #note-timknip • 5 years ago

a if condition else b

https://docs.python.org/3.3/faq/programming.html#is-there-an-equivalent-of-c-s-ternary-operator

[on_true] if [expression] else [on_false]

x, y = 50, 25
small = x if x < y else y
#python
5 years ago in #note-timknip by timknip (60)
$0.66
  • Past Payouts $0.66
  • - Author $0.33
  • - Curators $0.33
33 votes
  • + justyy
  • + steem-agora
  • + jianan
  • + cnbuddy
  • + blockcleaner
  • + sweet-jenny8
  • + dongfengman
  • + ericandryan
  • + dailystats
  • + dailychina
  • + witnesstools
  • + superbing
  • + ilovecoding
  • + cplusplus
  • + sexybeach
  • + andrewma
  • + happyukgo
  • + ethanlee
  • + laiyuehta
  • + cnbuddy-reward
  • and 13 more
Reply 0