[[email protected] day01]# python 3.py
Please input a number:1
Please input a number:2
3
-1
2
0
1 + 2 = 3
1 - 2 = -1
1 * 2 = 2
1 / 2 = 0
[[email protected] day01]# cat 3.py
#!/usr/bin/python
num1 = input("Please input a number:")
num2 = input("Please input a number:")
print num1 + num2
print num1 - num2
print num1 * num2
print num1 / num2
print "%s + %s = %s" % (num1, num2, num1 + num2)
print "%s - %s = %s" % (num1, num2, num1 - num2)
print "%s * %s = %s" % (num1, num2, num1 * num2)
print "%s / %s = %s" % (num1, num2, num1 / num2)
时间: 2024-10-29 13:06:51