码农心 发表于 2022-5-7 10:20:58

觉得好难啊啊啊 啊

KinokoCC 发表于 2022-5-18 14:06:59

每天学习,我就是在进步。
为什么要将元组设计成不可变的序列呢?虽然知道了元组的定义和语法,但是还是想快一点知道具体应用呀。

Mxxxx. 发表于 2022-5-24 18:24:29

打卡

sinsis 发表于 2022-6-15 01:10:12

谢谢

ctx111 发表于 2022-8-4 22:07:05

打卡
>>> a=1,2,3,4,5,'ctx'
>>> a
(1, 2, 3, 4, 5, 'ctx')
>>> a
1
>>> a[-1]
'ctx'
>>> a[:]
(1, 2, 3, 4, 5, 'ctx')
>>> a
(3, 4, 5, 'ctx')
>>> a[:3]
(1, 2, 3)
>>> a[::3]
(1, 4)
>>> a[::-1]
('ctx', 5, 4, 3, 2, 1)
>>> n=3,1,6,7,7,9,7,0,3,4
>>> n
(3, 1, 6, 7, 7, 9, 7, 0, 3, 4)
>>> n.count(3)
2
>>> n.count(7)
3
>>> n.index(7)
3
>>> n.index(6)
2
>>> n.index(9)
5
>>> b=a,n
>>> b
((1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4))
>>> for each in n:
        print(each)

       
3
1
6
7
7
9
7
0
3
4
>>> for i in b:
        for each in i:
                print(each)

               
1
2
3
4
5
ctx
3
1
6
7
7
9
7
0
3
4
>>>
[(1, 2, 3, 4, 5, 'ctx', 1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4, 3, 1, 6, 7, 7, 9, 7, 0, 3, 4)]
>>>

>>>

>>>x=(1,)

SyntaxError: unexpected indent
>>> x=(1,)
>>> x
(1,)
>>> type(x)
<class 'tuple'>
>>> t=a,b,n
>>> t
((1, 2, 3, 4, 5, 'ctx'), ((1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4)), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4))
>>> a,b,n=t
>>> a
(1, 2, 3, 4, 5, 'ctx')
>>> b
((1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4))
>>> n
(3, 1, 6, 7, 7, 9, 7, 0, 3, 4)
>>> a,b,c,d,e="ctx"
Traceback (most recent call last):
File "<pyshell#273>", line 1, in <module>
    a,b,c,d,e="ctx"
ValueError: not enough values to unpack (expected 5, got 3)
>>> a,b,c="ctx"
>>> a
'c'
>>> b
't'
>>> c
'x'
>>> "ctx"=a,b,c
SyntaxError: cannot assign to literal
>>> =t
SyntaxError: cannot assign to literal
>>> y=
>>> z,x,c,v,m=y
>>> z
1
>>> x
2
>>> c
3
>>> v
4
>>> m
5
>>> a,*b='ctx'
>>> a
'c'
>>> b
['t', 'x']
>>>
>>> q=(,)
>>> q=8
Traceback (most recent call last):
File "<pyshell#292>", line 1, in <module>
    q=8
IndexError: tuple index out of range
>>> q
(, )
>>> q
Traceback (most recent call last):
File "<pyshell#294>", line 1, in <module>
    q
IndexError: tuple index out of range
>>> q
5
>>> q
7
>>> q=11111
>>> q
(, )
>>> z,y=12,45
>>> z
12
>>> y
45
>>> _=(12,45)
>>> z,y=_
>>> z
12
>>> y
45

JZt2902019046 发表于 2022-8-10 10:40:28

打卡

xydsds 发表于 2022-8-21 11:24:17

{:5_109:}

胚芽鞘 发表于 2022-9-7 20:59:36

{:10_243:}

chenjinchao 发表于 2022-9-9 17:19:19

hello world

墨墨在努力吖 发表于 2022-10-1 12:29:01

滴滴滴~打卡{:10_298:}

风一样的僧 发表于 2022-10-2 20:33:40

{:10_254:}

foolwolf0068 发表于 2022-10-4 16:43:51

今天继续学习

foolwolf0068 发表于 2022-10-5 10:09:52

元组复习,继续

空白君学python 发表于 2022-10-22 00:14:16

打卡

荔Ⅹ 发表于 2022-10-26 22:54:53

学习学习

yes120 发表于 2022-10-27 17:16:01

学习打卡

migu_sm1 发表于 2022-11-2 11:30:09

Learning...

独酌dz 发表于 2022-11-6 21:15:46

1

jgz1818 发表于 2022-11-14 22:28:08

学完了,能听懂,有没有会员的朋友给我白剽一下练习题呢{:10_256:}

xxxx.xxxx 发表于 2022-12-1 16:12:04

学习打卡
页: 1 [2] 3
查看完整版本: 第026讲:元组