How to print the value of a variable in Python?
In Python, you can use the print() function to display the value of a variable. For example:
# 定义一个变量
x = 10
# 打印变量的值
print(x)
The output will be:
10
You can also print the values of multiple variables at the same time, separating them with commas. For example:
# 定义两个变量
x = 10
y = 5
# 打印变量的值
print(x, y)
The output is:
10 5