不枉风来水顺
发表于 2023-7-3 12:49:11
6
周杰差个伦
发表于 2023-11-20 22:57:26
这节课的课后作业动动手第0题,为什么要判断是空列表呢?
导盲犬
发表于 2024-2-29 10:33:02
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb6 2024, 21:15:12) on win32
Type "help", "copyright", "credits" or "license()" for more information.
x = "123321"
"是回文数字" if x == x[::-1] else "不是回文数字"
'是回文数字'
x = "123456789"
"是回文数字" if x == x[::-1] else "不是回文数字"
'不是回文数字'
x = "what are you doing now?"
x.capitalize()
'What are you doing now?'
x.casefold()
'what are you doing now?'
x.title()
'What Are You Doing Now?'
x.swapcase()
'WHAT ARE YOU DOING NOW?'
x.upper()
'WHAT ARE YOU DOING NOW?'
x.lower ()
'what are you doing now?'
x.center()
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
x.center()
TypeError: center expected at least 1 argument, got 0
x.center(5)
'what are you doing now?'
x.center(15)
'what are you doing now?'
x="我的妈呀,快跑"
x.center(5)
'我的妈呀,快跑'
x.center(15)
' 我的妈呀,快跑 '
x.rjust()
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
x.rjust()
TypeError: rjust expected at least 1 argument, got 0
x.rjust(5)
'我的妈呀,快跑'
x.rjust(15)
' 我的妈呀,快跑'
x.ljust(15)
'我的妈呀,快跑 '
x.zfill(15)
'00000000我的妈呀,快跑'
'00000000我的妈呀,快跑'
'00000000我的妈呀,快跑'
x.ljust(14,"啊")
'我的妈呀,快跑啊啊啊啊啊啊啊'
x.rjust(14,"啊")
'啊啊啊啊啊啊啊我的妈呀,快跑'
x.center(14,"啊")
SyntaxError: invalid character ')' (U+FF09)
x.center(14,"啊")
'啊啊啊我的妈呀,快跑啊啊啊啊'
JTYBLCC
发表于 2024-7-25 23:15:21
学完打卡
额滴神
发表于 2024-11-12 11:22:32
学习中!!!!难度上来了》。。
sunshine_8205
发表于 2024-12-3 17:07:40
{:5_108:}