【Python】小练习

print("Hello,world!")

if 5>2:
 print("5大于2")

 #这是一个注释
 """这也是一个注释"""

x = 5
y = "Hello, World!"
print(x)
print(y)

x = 5 # x is of type int
x = "Steve" # x is now of type str
print(x)

x = "Bill"
# is the same as
x = 'Bill'
print(x)

x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)

x = "awesome"
print("Python is " + x)

x = "Python is "
y = "awesome"
z =  x + y
print(z)

x = 5
y = 10
print(x + y)

#如果您尝试组合字符串和数字,Python 会给出错误
x = 10
y = "Bill"
print(x + y)

结果:

原文地址:https://www.cnblogs.com/HGNET/p/12031423.html