推 dendrobium:因為真的很少很少....寫XD 10/14 00:32
※ 引述《dendrobium (石斛蘭)》之銘言:
: Ruby:
: print ( "Weight is " + '%.3f'%(weight=gets.chomp.to_f).to_s + " kg, or " \
: + '%.3f'%(weight.to_f/0.454).to_s + " pound.\n" )
: 寫的很糟XD, 不過還是控制在一行之內
: 也很好看得懂
: 高高手應該是寫那種一行而且要執行才看的出來在幹麼的吧XD
weight = gets.to_f
puts "Weight is %.3f(kg),%.3f(pound)" %[weight,weight/0.454]
有必要寫那麼硬嗎?
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.166.119.199