时空飞船
程序员文章站
2022-07-03 20:33:55
时空飞船——一个纯粹拼手速的小游戏import Drivedef trans(data,n): #第二个参数为进制 if n == 2: data = bin(data) #二进制 elif n == 8: data = oct(data) #八进制 elif n == 16: data = hex(data) #十六进制data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAA...
时空飞船——一个纯粹拼手速的小游戏
import Drive
def trans(data,n): #第二个参数为进制
if n == 2:
data = bin(data) #二进制
elif n == 8:
data = oct(data) #八进制
elif n == 16:
data = hex(data) #十六进制data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABXUlEQVRIS+2VPUrEUBSFv1NooeACFC0tRBHEqay0EUHBXbgGV+Aa3MWAgthoZaUI4mBhqegCBKfQ4sgbXoYk5OelSGeqhHfv+e5P7n2i50ep+rYXgftoP5D0meKbBIjit8BqFH0FdlMgrYAK8SzwJEgK4BlYB4JgPoPwPpK00VSqFMAjMAPsAx9RbAm4Bn4lbSUDbIdIz4A94EXSIO9s2+FbUiEw26H5a8ANcCpplPlNDaP4HbAQDx86Araj3xewk0HygAvgELgCTiS9l1O3/RMzmK04WwbOgQPgUtLRxDYztP0NzAErVeLBzvZxBAyr6m47QN6AsaT5MqCyvinD1NSnfAYFQIx2MxHwJGmSVflHaAJkJUthTEvSBRDq3V8GKWHXNLpQ6toS9Q74b3K2rzpNcltf2ia5dRc1AaJ44y4Kqzq/TdsCrjuv3qZxzPP3QVh8XZ5x433QRamL7R+hceIZLTgS7gAAAABJRU5ErkJggg==
elif n == 10:
data = int(data) #十进制
else:
print("参数错误")
return data
# 设置飞船驾驶员名称
mycard = {
"ID":1000,
"age":1000,
"height":200,
"weight":666,
"IQ":180,
"wealth":0
}
print("转化前飞船驾驶员信息:", mycard)
mycard2 = {} #定义一个新字典来存储转化后的信息
for key in mycard:
mycard2[key] = trans(mycard[key], 2)
print("转化后飞船驾驶员的信息:", mycard2)
#开启冒险之旅,收集金币
Drive.drive(mycard2)
导入的库有附件,详见https://blog.csdn.net/Zhaosw2009/article/details/110294895
本文地址:https://blog.csdn.net/Zhaosw2009/article/details/110294917