二十五岁时我们都一样愚蠢、多愁善感,喜欢故弄玄虚,可如果不那样的话,五十岁时也就不会如此明智。
标题:Python3 运算符优先级
Python3 运算符优先级
#!/usr/bin/python3 a = 20 b = 10 c = 15 d = 5 print ("a:%d b:%d c:%d d:%d" % (a,b,c,d )) e = (a + b) * c / d #( 30 * 15 ) / 5 print ("Value of (a + b) * c / d is ", e) e = ((a + b) * c) / d # (30 * 15 ) / 5 print ("Value of ((a + b) * c) / d is ", e) e = (a + b) * (c / d) # (30) * (15/5) print ("Value of (a + b) * (c / d) is ", e) e = a + (b * c) / d # 20 + (150/5) print ("Value of a + (b * c) / d is ", e)