def data_of_square(side):
C= 4*side
S=side * side
print('c is {},s is {}'.format(C,S))
return C,S
C,S= data_of_square(6)
print('周長(zhǎng)={}'.format(C))
print('面積={}'.format(S))
C= 4*side
S=side * side
print('c is {},s is {}'.format(C,S))
return C,S
C,S= data_of_square(6)
print('周長(zhǎng)={}'.format(C))
print('面積={}'.format(S))
2020-10-19
最贊回答 / 一地幾毛
可以是可以,但是多此一舉啊language = 'Phtyon'result = template.format (language)可以縮寫成一句result = template.format ('Phtyon')你這個(gè)是多個(gè)變量要套進(jìn)去才用得著這種形式
2020-10-19
最新回答 / qq_迷失在天堂里云_0
remove函數(shù)只能刪除首個(gè)滿足條件的數(shù),不如換種方式
c=[2,5,2,3,3,4,8,'a','b','c','d',1.1] c2=[] for?t?in?c: ????if??isinstance(t,float)?or?isinstance(t,int): ????????c2.append(t) print(c2)
2020-10-18
最新回答 / 四餅同學(xué)
r'''...'''會(huì)對(duì)'''...'''中的內(nèi)容進(jìn)行轉(zhuǎn)義單獨(dú)的'''...''',就只是一個(gè)換行的作用<...圖片...>
2020-10-18
最新回答 / 慕無忌7227368
# Enter a coded = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}for key in d.keys():? ? for score in d[key]:? ? ? ? print(key, score)? ??
2020-10-18
# coding=utf-8
d = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
template = "{}的第{}次成績(jī)是{}分"
for key, value in d.items():
for index in range(len(value)):
print(template.format(key,index+1,value[index]))
d = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
template = "{}的第{}次成績(jī)是{}分"
for key, value in d.items():
for index in range(len(value)):
print(template.format(key,index+1,value[index]))
2020-10-18
最贊回答 / 慕前端6152346
可能是b=' '?單引號(hào)之間輸入了空格,輸出的是hello,如果是b='',單引號(hào)沒有空格,輸出的是hello,world
2020-10-17
a = 'python'
print 'hello,', a or 'world'
b = ''
print 'hello,', b or 'world'
a為有效字符串,即為true; 則 = true
b為空字符串,即為false; 則 = false
print 'hello,', a or 'world'
b = ''
print 'hello,', b or 'world'
a為有效字符串,即為true; 則 = true
b為空字符串,即為false; 則 = false
2020-10-15
已采納回答 / weixin_慕沐9146932
year = '今年 {} 歲'age = 19if age >= 18:? ? print(year.format(age))
2020-10-15
def greet(c='World'):
print('hello'+','+c)
return
greet()
greet('sb')
print('hello'+','+c)
return
greet()
greet('sb')
2020-10-13