攝影或3C

Python 範例8-3,輸入9種水果,3個排一列

#Python 3.X 程式語言特訓教材 8-31頁

#8-3

lst=[]
for i in range(1,10):
str1=input()
lst.append(str1)

for k in range(1,10):
if k%3 != 0 :
print(“|”+lst[k-1].ljust(15)+”|”,end=””)
else:
print(“|”+lst[k-1].ljust(15)+”|”)

 

#8-4

#結尾e的水果才納入list中

lst=[]

while True:
str1=input()
if str1 == “end” : break
if str1.endswith(“e”):lst.append(str1)

print(lst)

 

#8-5

str1=input()
print(str1[0])
for i in range(len(str1)):
if str1[i].isdigit():
print(str1[i]+”: is a digit.”)
elif str1[i].isalpha() and str1[i].isupper():
print(str1[i]+”: is upper alpha.”)
elif str1[i].isalpha() and str1[i].islower():
print(str1[i]+”: is lower alpha.”)
elif str1[i].isalpha() and str1[i].isspace():
print(str1[i]+”: is a space.”)
else: print(str1[i]+”: is a symbol.”)

 

儲蓄保險王

儲蓄險是板主最喜愛的儲蓄工具,最喜愛的投資理財工具則是ETF,最喜愛的省錢工具則是信用卡