本文共 439 字,大约阅读时间需要 1 分钟。
#!/usr/bin/python
# -*- coding:UTF-8 -*- def sum(options,x,y): t = options if(t == "+"): print "x+y=",x+y elif(t == "-"): print "x-y=",x-y elif(t == "*"): print "x*y=",x*y else: print "x/y=",x/y def main(): options = raw_input("Please enter a method:") x = input("Enter a Num:") y = input("Enter another Num:") sum(options,x,y) if __name__ == '__main__': main()
本文转sinojelly51CTO博客,原文链接:http://blog.51cto.com/pnig0s1992/358026,如需转载请自行联系原作者