#請自行選用函式使用 #def #if else #ex1 num+mde 1~60 43 print None def ex1(): for num in range(1,60): if(num==43): print("None") else: print("Number:",40023100+num,"Department of Mechanical Design Engineering") #ex2 num+girl or boy 43no print def ex2(): for num in range(1,60): if(num!=43): if(num<=10): print("Number:",40023100+num,"girl") else: print("Number:",40023100+num,"boy") #ex3 socre A(81~100)B(41~80)C(1~40) def ex3(): for score in range(1,101): if(score<=40): print("Score:",score,"C") elif(score>40 and score<=80): print("Score:",score,"B") else: print("Score:",score,"A") def myadd(var1, var2): return (var1+var2) def myfun(): print("Hello World!") #ex4 funstory input bird(string) def fun(bird): print("有個小姐逛街走入一家店時,") print("店門口有一隻",bird,"大聲的喊『歡迎光臨』。") print("她覺得很好奇, 想試試看這隻",bird,"是不是真的這麼聰明,") print("就又走了出去") print("結果這隻",bird,"真的對她說『謝謝光臨。』") print("她覺得很好玩,於是又走了進去,『歡迎光臨』。") print("又走了出來『謝謝光臨』。") print("她來來回回走了十幾次,") print(bird,"也一直說『歡迎光臨』,『謝謝光臨』。") print("於是她又走進去,") print("這次這隻",bird,"不再理她,") print("反而轉過頭去對著裡面大喊:『老闆,有人在玩你的鳥』。") #可以直接印出回傳(return)值 print(myadd(1,2)) """ #也可以將回傳值存在另一變數,之後將之印出 temp=myadd(1,2) print(temp) """ myfun() #fun("鸚鵡") """ 英語小補帖(與課程無關,僅供參考) 1. You had me at hello. 0你一開口就征服我了 1你跟我說哈囉 2. Life will find its own way. 0我可以靠自己找路 1生命會自己找出口 3.Stupid is as stupid does. 0你是個笨蛋 1傻人有傻福 4. Destiny takes a hand. 0命中注定 1有錢能使鬼推磨 5. Am I reaching for the stars here? 0我是在強人所難嗎 1你很難追 6. I'll be back 0我會回來的 1我在你後面 answer:011000 """
2011年9月27日 星期二
100設計一甲_week2
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言