if else 和if elif else的区别
def fuck(a): if a ==1: print(a) if a ==2: print("not good") else: print("tamade") def fuckelif(a): if a==1: print(a) elif a==2: print("not good") else: print("tamade") if __name__=="__main__": print("use if..if..") fuck(1) print("use if..elif..") fuckelif(1)
results:
use if..if..
1
tamade
use if..elif..
1