Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
42
Help us understand the problem. What is going on with this article?
@zakuroishikuro

で、オライリー本を全冊購入するといくらなのか

More than 5 years have passed since last update.

オライリー・ジャパンの書籍380冊、全部買った
という記事が話題になってましたが、合計金額がなかったので調べました。

oreilly.rb
require 'open-uri'
require 'nokogiri'

open("http://www.oreilly.co.jp/catalog/") do |f|
  doc = Nokogiri::HTML.parse f.read
  prices = doc.css(".price").map{|p| p.text.tr(?,, '').to_i }
  amount = prices.inject(:+).to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,')

  puts "合計 #{prices.size}#{amount}円"
end
結果
合計 419冊 1,442,556円

全巻一括購入で割引とかあるんでしょうか。分かりません。

てか、ブログの記事より40冊ほど多いですね。
ざっくり一冊平均3442円なので380冊で130万8318円ぐらいでしょうか。

42
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
zakuroishikuro
アイコンお借りしました→http://www.nicotalk.com/ktykroom.html

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
42
Help us understand the problem. What is going on with this article?