标签:技术分享 png 直接 room 方法 kill 内容 python 类 变量
实例一:
print(499*561+10620-365)
print((5025-525)/100+18*17)
结果:
print(499*561+10620-365)
print((5025-525)/100+18*17)
实例二:浮点数
print(0.55+0.3)
结果:
bash:81$ python ~/classroom/apps-1-id-5c3d88f18939b4000100e7d9/81/main.py
0.8500000000000001
实例三:内容拼接
hero1 = ‘亚瑟‘
hero2 = ‘李白‘
action = ‘秒掉‘
gain = ‘获得‘
achieve = ‘First Blood‘
print(hero1+action+hero2+gain+achieve)
print(hero2+action+hero1+gain+achieve)
结果:
亚瑟秒掉李白获得First Blood
李白秒掉亚瑟获得First Blood
实例四:显示内容的类型
hero = ‘亚瑟‘
enemy = ‘敌方‘
action = ‘秒杀‘
gain = ‘获得‘
number = 5
achieve = ‘Penta Kill‘
print(type(hero))
print(type(enemy))
print(type(action))
print(type(gain))
print(type(number))
print(type(achieve))
结果:
<class ‘str‘>
<class ‘str‘>
<class ‘str‘>
<class ‘str‘>
<class ‘int‘>
<class ‘str‘>
实例五:数据类型转换方法
hero = ‘亚瑟‘
enemy = ‘敌方‘
action = ‘秒杀‘
gain = ‘获得‘
number = 5
achieve = ‘Penta Kill‘
print(hero+action+str(number)+enemy+gain+achieve)
将字符串与数值拼接,使用str()
结果:
亚瑟秒杀5敌方获得Penta Kill
print(slogan+‘10000‘+unit+character+place+action),也可以直接变量+引号数值进行拼接
标签:技术分享 png 直接 room 方法 kill 内容 python 类 变量
原文地址:https://www.cnblogs.com/bzdmz/p/10323756.html