wideband 发表于 2023-4-2 09:40:13

a = eval(input("长,宽,高:"))
print(type(a))

tuple类型
a = 10,20,30

wideband 发表于 2023-4-2 10:03:17

a = input("c,k,g:")#str:10,20,30
b = a.split(",")#list,返回一个包含分割结果的列表

wideband 发表于 2023-4-2 10:30:17

int()不能将带有小数点的字符串转化为整数类型。可以在int()里加入float(),先强制转换为浮点型,再转换为整数型。

wideband 发表于 2023-4-2 12:27:10

turtle.goto(x, y)
turtle.colormode(255)
turtle.pencolor("green")
turtle.circle(100, 360, 8)   # 绘制半径100的八边形
t.done()

wideband 发表于 2023-4-2 12:57:55

count = {} #定义一个空字典
count+=1# 比如 x 为 to, 则意味:{'to' :1}, 统计数量?

wideband 发表于 2023-4-3 10:01:21

count = {}#定义一个空字典,不重复;    定义空集合set1 = set()    元素也不重复;
print(type(count))

if x not in count:
      count=1

wideband 发表于 2023-4-3 14:41:18

dd = {'1':'一','2':'二','3':'三','4':'四','5':'五','6':'六','7':'七','8':'叭','9':'九'}
while True:
    a = int(input("请输入数字1 to 9:"))
    print(dd)

输出:一

wideband 发表于 2023-4-4 16:15:29

t.fillcolor('black')
t.begin_fill()
time.sleep(20)

wideband 发表于 2023-4-4 16:26:38

从turtle.begin_fill()开始到 turtle.end_fill()结束,对从起始点到终点的连线和轨迹所围成的闭合区域填充颜色

wideband 发表于 2023-4-6 07:10:36

三种可变序列:数值(int、float)、字符串(str)、列表(list), 数据变化,内存地址就变了。

三种不可变序列:字典(dict)、元组(tuple)、集合(set)

wideband 发表于 2023-4-6 08:06:30

上述可变不可变有错误,错误来源CSDN复制。

结论:不可变类型,就是改变变量值,地址就变了。比如: 整形,字符串,浮点,元祖。       可变类型:容器类列表,集合,字典。除了元祖。

#元组是不可变序列:同时操作,无需加锁;
# t 不可以改成其他数据,但是可以增加?
t=(10,,9) #可以看,可以取数据,但是不能增,删,改
print("t",t,type(t),id(t))
print("t",t,type(t),id(t))
print("t",t,type(t),id(t))
print("t",t,type(t),id(t))
t.append(100)
print("                              ")
print("t",t,type(t),id(t))
print("t",t,type(t),id(t))
print("t",t,type(t),id(t))
print("t",t,type(t),id(t))

序列.py =======
t (10, , 9) <class 'tuple'> 1901582367840
t 10 <class 'int'> 140727162496112
t <class 'list'> 1901579746184
t 9 <class 'int'> 140727162496080
                              
t (10, , 9) <class 'tuple'> 1901582367840
t 10 <class 'int'> 140727162496112
t <class 'list'> 1901579746184
t 9 <class 'int'> 140727162496080
页: 1 [2]
查看完整版本: No module named 'paddle'