首页 > 编程语言 > 详细

【Python】小练习

时间:2019-12-12 21:13:16      阅读:88      评论:0      收藏:0      [点我收藏+]
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)

结果:

技术分享图片

 

 

【Python】小练习

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!