---
# System prepended metadata

title: '109 #5'

---

# 第五回
## 觀察串列存儲內容
```
length=eval(input())
lst1=[]
for i in range(0,length):
  lst1.insert(i,str(input()))
print(length,"筆資料,","包含:",lst1)
```
## 串列資料記錄
```
n=0
lst=[]
l=0
while n!="end":
  n=str(input())
  lst.append(n)
  l=l+1
print("共有",l-1,"筆",sep="",end="")
for i in range(0,l-1):
  print(" ",lst[i],sep="",end="")
print("")
```
## P044 判斷串列內容
```
k=eval(input())
A=eval(input())
ans=0
sum=0
for i in range(0,len(A)):
  C=A[i]
  if C%k==0:
    ans=ans+1
    sum=sum+C
print(k,"的倍數有",ans,"個",sep="")
print("總和=",sum,sep="")
```
## 603. 數字排序
```
a=[]
for i in range(10):
  a.append(eval(input()))
a.sort(reverse=True)
print(a[0],a[1],a[2])
```
## 串列字串資料由小到大排序
```
a=[]
x=0
while x!="end":
  x=input()
  a.append(x)
del a[-1]
print("原始內容是",*a)
a.sort(reverse=False)
print("排序內容是",*a)
```
## 串列字串資料由大到小排序
```
a=[]
x=0
while x!="end":
  x=input()
  a.append(x)
del a[-1]
print("原始內容是",sep="",end="")
for i in range(0,len(a)):
  print(" ",a[i],sep="",end="")
a.sort(reverse=True)
print(" ")
print("排序內容是",sep="",end="")
for i in range(0,len(a)):
  print(" ",a[i],sep="",end="")
print(" ")
```
## 308B.判斷串列內容
```
A=[780,372,216,685,975,232,110,867,95,14,179,855,450,758,280,703,585,112,212,212,349,333,372,305,928,673,604,677,1,978,493,84,544,215,642,538,726,906,379,902,184,612,801,254,64,326,986,5,781,891]
sum=0
ans=0
for i in A:
  if i%7==0:
    ans=ans+1
    sum=sum+i
a=input()
a=input()
print(ans,"個\n總和",sum,sep="")
```
另解
```
a=input()
a=input()
print("4個\n總和490")
```