英文版:
繁體版:
(繁體+英文-》簡體)
現在新增一批練習,在練習過程中寫**,並讓你的**執行起來。這裡不會有很多詳細的解釋,因為大部分都是以前的內容。這次練習的目的是為了鞏固你學到的東西,後面再新增息內容——不要跳過,不要複製貼上。
puts "mary had a little lamb.
"puts
"its fleece was white as #.
"puts
"and everywhere that mary went.
"puts ".
" * 10 #
what'd that do?
end1 = "c"
end2 = "h"
end3 = "e"
end4 = "e"
end5 = "s"
end6 = "e"
end7 = "b"
end8 = "u"
end9 = "r"
end10 = "g"
end11 = "e"
end12 = "r"
#watch that print vs. puts on this line what's it do?
print end1 + end2 + end3 + end4 + end5 +end6
puts end7 + end8 + end9 + end10 + end11 + end12
輸出結果:
$ ruby ex7.rbmary had a little lamb.
its fleece was white as snow.
and everywhere that mary went.
..........
cheeseburger
課後習題:
後面幾節的思考題都是一樣的
1、回去閱讀你的**並且在每一行新增注釋
2、倒著閱讀你的**,找出你的錯誤
3、從現在開始,記錄你犯的每乙個錯誤,並且說明原因及解決方案
4、當你準備下一次練習的時候,回顧一下你的錯誤集錦,並且吸取教訓,盡量在下一次練習中不要犯相同的錯誤。
5、記住:是人都會犯錯!程式設計師們就像魔術師一樣,讓人們覺得他們的表演很完美,但是那一切都是表象,並且他們也時不時會犯些錯誤。
Python 題庫練習七
what gets printed?nums set 1,1,2,3,3,3,4 print len nums 題目解析 這題考察set方法的特性 在jupter notebook中敲入相應 執行,看結果 nums set 1 1,2 3,3 3,4 print len nums 執行結果 4set...
《七天七語言》之Ruby練習1
列印字串 hello,world.puts hello,world.在字串 hello,ruby.中,找出 ruby.所在下標。hello,ruby.index ruby.列印你的名字十遍。i 10 while i 0 i i 1 puts zq end 列印字串 this is sentence ...
第七周 OJ練習 3
問題及 題目描述 輸入三條邊的長度,如果這三條邊能構成三角形,則需要計算三角形面積,如果不能構成三角形則輸出提示資訊 error input 輸出的面積按兩位小數方式輸出 輸入三條邊的長度 輸出如果這三條邊能構成三角形,則輸出該三角形面積,如果這三條邊不能構成三角形,則輸出提示資訊 error in...