7-3 10的整數倍
**:
num = int(input("請輸入乙個數字:"))結果:ifnum % 10 == 0:
print("這個數字是10的整數倍")
else:
print("這個數字不是10的整數倍")
請輸入乙個數字:100
這個數字是10的整數倍
請輸入乙個數字:99
這個數字不是10的整數倍
7-5 電影票
**:
message =""while true:message = input("請輸入你的年齡,或者輸入exit退出:")
ifmessage =="exit":
breakage = int(message)
ifage >= 0
andage <= 3:
print("電影票免費")
elifage > 3
andage <=12:
print("電影票10美元")
elifage >12:
print("電影票15美元")
結果:請輸入你的年齡,或者輸入exit退出:2
電影票免費
請輸入你的年齡,或者輸入exit退出:5
電影票10美元
請輸入你的年齡,或者輸入exit退出:15
電影票15美元
請輸入你的年齡,或者輸入exit退出:exit
7-8 熟食店
**:
sandwich_orders = ["雞蛋火腿三文治","海苔三文治","鰻魚三文治","肉鬆三文治"]結果:finished_sandwichs =
whilesandwich_orders:
sandwich = sandwich_orders.pop(0)
print(sandwich +"做好了")
print("所有三文治都做好了,以下是所有做好的三文治的列表:")
print(finished_sandwichs)
雞蛋火腿三文治做好了
海苔三文治做好了
鰻魚三文治做好了
肉鬆三文治做好了
所有三文治都做好了,以下是所有做好的三文治的列表:
['雞蛋火腿三文治', '海苔三文治', '鰻魚三文治', '肉鬆三文治']
高階程式設計技術課後作業 第五章練習
5 2 更多的條件測試 print abc abc print aaa bbb print abc abc print abc lower abc print 1 2 and2 1 print 1 2 or2 1 list a b c d print a inlist print a not inl...
高階程式設計技術 sklearn課後作業
作業要求 1 create a classification dataset n samples 1000,n features 10 2 split the dataset using 10 fold cross validation 3 train the algorithms gaussian...
java第七章陣列課後作業
1.首先依次輸入五句話,然後將它逆序輸出。public static void test for int i 0 i string.length i system.out.println n 逆序輸出5句話為 for int i string.length 1 i 0 i 2.某百貨商場當日消費積分...