Skip to content

Commit 460b65f

Browse files
committed
Create 1001S02E05_array.py
1 parent 32b2e16 commit 460b65f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

1901010091/1001S02E05_array.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
a=[0,1,2,3,4,5,6,7,8,9]
2+
b=a[::-1]#反转列表
3+
print(b)
4+
c=[str(i)for i in b]#将列表变为含有‘’列表
5+
print(c)
6+
d=''.join(c)#‘’.join(c)将列表转为字符串
7+
print(d)
8+
9+
e=d[2:8]#选取3到8位字符串
10+
print(e)
11+
12+
f=list(e)#将字符串转化成列表
13+
print(f)
14+
g=f[::-1]#反转列表
15+
print(g)
16+
h=''.join(g)#将含‘’列表转化成字符串
17+
print(h)
18+
19+
j=int(h)#将字符串转化成整型
20+
print(bin(j),oct(j),hex(j))#将整数转化成二进制,八进制,十六进制

0 commit comments

Comments
 (0)