a = r'''
"to be,or not to be":that is the question
whether it's nobler in hte mind to suffer!'''
print (a)
"to be,or not to be":that is the question
whether it's nobler in hte mind to suffer!'''
print (a)
2025-02-28
L1 = [1, 2, 3]
L2 = [5, 3, 2]
L3 = [7, 3, 2]
def s(L):
A = L[0] * L[1] + L[1] * L[2]+ L[0] * L[2]
return A
print(s(L1), s(L2), s(L3))
L2 = [5, 3, 2]
L3 = [7, 3, 2]
def s(L):
A = L[0] * L[1] + L[1] * L[2]+ L[0] * L[2]
return A
print(s(L1), s(L2), s(L3))
2025-02-28
a = 'python'
print('hello,', a or 'world')
#a為非空字符串,所以為True,或運(yùn)算,a為True則返回a
b = ''
print('hello,', b or 'world')
#b為空字符串,所以為False,b為False,或運(yùn)算,有一個(gè)為True則結(jié)果為True,所以返回后面的word
print('hello,', a or 'world')
#a為非空字符串,所以為True,或運(yùn)算,a為True則返回a
b = ''
print('hello,', b or 'world')
#b為空字符串,所以為False,b為False,或運(yùn)算,有一個(gè)為True則結(jié)果為True,所以返回后面的word
2025-02-27
3.1415926 浮點(diǎn)數(shù)
'Learn Python in imooc.' 字符串
100 整數(shù)
0b1101 二進(jìn)制整數(shù)
'Learn Python in imooc.' 字符串
100 整數(shù)
0b1101 二進(jìn)制整數(shù)
2025-02-27
s = "ABCDEFGHIGKLMNOPQRSTUVWXYZ"
print(s[3])
print(s[0:4])
print(s[1:])
print(s[1:3])
print(s[ :3])
print(s[1: ])
print(s[3])
print(s[0:4])
print(s[1:])
print(s[1:3])
print(s[ :3])
print(s[1: ])
2025-02-23
>>> Length=3.14
>>> Width=1.57
>>> result=round(Length*Width,2)#
>>> print(result)
4.93
>>> Width=1.57
>>> result=round(Length*Width,2)#
>>> print(result)
4.93
2025-02-22
>>> Python='寶庫'#
>>> print(Python)
寶庫
>>> I='我'#
>>> Love='愛'#
>>> Python='Python計(jì)算機(jī)語言'#
>>> print(I,Love,Python)
我 愛 Python計(jì)算機(jī)語言
>>> s='雖然'#
>>> i='我'#
>>> B='很笨'#
>>> print(s,i,B)
雖然 我 很笨
>>> D='但是'#
>>> i='我'#
>>> N='努力'#
>>> print(D,i,N)
但是 我 努力
>>> H='會(huì)'#
>>> C='成功'#
>>> print(i,H,C)
我 會(huì) 成功
>>> print(Python)
寶庫
>>> I='我'#
>>> Love='愛'#
>>> Python='Python計(jì)算機(jī)語言'#
>>> print(I,Love,Python)
我 愛 Python計(jì)算機(jī)語言
>>> s='雖然'#
>>> i='我'#
>>> B='很笨'#
>>> print(s,i,B)
雖然 我 很笨
>>> D='但是'#
>>> i='我'#
>>> N='努力'#
>>> print(D,i,N)
但是 我 努力
>>> H='會(huì)'#
>>> C='成功'#
>>> print(i,H,C)
我 會(huì) 成功
2025-02-22
# Enter a code
L = [75, 92, 59, 68, 99]
sum = 0
for i in L:
sum += i
avg = sum / len(L)
print(avg)
L = [75, 92, 59, 68, 99]
sum = 0
for i in L:
sum += i
avg = sum / len(L)
print(avg)
2025-02-13
>>> print('hello {},hello{},hello{}'.format('sha bi','da sha bi','chaoji da sha bi'))
hello sha bi,helloda sha bi,hellochaoji da sha bi
>>> print('hello {a},hello ,hello {c}'.format(a='sha bi',b='da sha bi',c='chaoji da sha bi'))
hello sha bi,hello da sha bi,hello chaoji da sha bi
hahahahahahaha~
hello sha bi,helloda sha bi,hellochaoji da sha bi
>>> print('hello {a},hello ,hello {c}'.format(a='sha bi',b='da sha bi',c='chaoji da sha bi'))
hello sha bi,hello da sha bi,hello chaoji da sha bi
hahahahahahaha~
2025-02-08