1 people = 30 2 cars = 40 3 trucks = 30 4 5 if cars < people: 6 print "We should take the cars." 7 8 elif people < trucks: 9 print "3" 10 11 elif people > trucks: 12 print "4" 13 14 elif people == trucks: 15 print "5" 16 17 elif cars > people: 18 print "We should not take the cars." 19 20 else: 21 print "We can't decide."
输出结果:
PS E:pytest> python ex301.py
5