Last active
February 27, 2018 08:26
-
-
Save Nursultan91/74f4e035e396ab47fc8e0b0eaaf4d036 to your computer and use it in GitHub Desktop.
Второе задание
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV.length != 1 | |
puts "We need exactly one parameter. The name of a file." | |
exit; | |
end | |
filename = ARGV[0] | |
puts "Going to open '#{filename}'" | |
fh = open filename | |
fh.each do |line| | |
movies = line.split("|") | |
if movies[1].include? "Max" | |
rank = (movies[7].to_f*10 - 80).to_i | |
puts "Title: #{movies[1]}, rank: #{rank.times {print "*"}}" | |
end | |
end | |
fh.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment