📜  python代码示例中的打印功能

📅  最后修改于: 2022-03-11 14:47:20.058000             🧑  作者: Mango

代码示例6
2 + 1
#Addition is done by Python, but doesn't show us the answer

print(2 - 1)
#output - 1 (This will solve and show us the answer, 2,1 and 3 all are integers)

x = 2 * 1
print(x)
#output - 2 (We have printed the varible and got the answer, all are integers)

x = 2
y = 1
print(x / y)
#output - 2.0 (When division is done answer is given as a float)

x = "2"
y = "1"
print(x + y)
#output - 21 (When two strings are added, it concatenate and the answer 
# is also a string)