課程
/后端開發
/Python
/Python3 入門教程(新版)
l?=?[] sun=a?l: ????sun=sun+a ????(sun/)
打印結果
15.0
33.4
45.2
58.8
78.6
2022-09-27
源自:Python3 入門教程(新版) 4-4
正在回答
注意for循環對應的層次,print的縮進位置不一樣,對應的不一樣,你這是對應的for循環,那么每循環一次就會打印一次,Python對縮進很嚴格
L = [75, 92, 59, 68, 99];
sum = 0;
i = len(L);
for ch in L:
? ? sum += ch;
print(sum/i);
# Enter a code
s1='ABC'
s2='123'
s3='xyz'
sout=''
for c1 in s1:
? ? for c2 in s2:
? ? ? ? for c3 in s3:
? ? ? ? ? ? sout= sout +c1+c2+c3+'\n'
print(sout)
舉報
python3入門教程,讓你快速入門并能編寫簡單的Python程序
3 回答set打印的結果是dict類型?
1 回答請問老師這個程序打印后16個字母,程序不出打印結果,運行還是正確的,錯在哪里?謝謝
3 回答打印前三名的題有沒有辦法自動排名,然后打印呢?
2 回答For 語句
1 回答為什么打印的result是tuple類型?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2022-11-09
注意for循環對應的層次,print的縮進位置不一樣,對應的不一樣,你這是對應的for循環,那么每循環一次就會打印一次,Python對縮進很嚴格
2022-10-03
L = [75, 92, 59, 68, 99];
sum = 0;
i = len(L);
for ch in L:
? ? sum += ch;
print(sum/i);
2022-09-28
# Enter a code
s1='ABC'
s2='123'
s3='xyz'
sout=''
for c1 in s1:
? ? for c2 in s2:
? ? ? ? for c3 in s3:
? ? ? ? ? ? sout= sout +c1+c2+c3+'\n'
print(sout)