-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement hw 1 #772
base: master
Are you sure you want to change the base?
implement hw 1 #772
Conversation
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
|
||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i,number)}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2 trailing blank lines detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
|
||
|
||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i,number)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after comma.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
number = gets.chomp.to_i | ||
|
||
|
||
for i in 0...n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer each over for.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
print "Введите базовый номер: " | ||
number = gets.chomp.to_i | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
|
||
print "Введите глубину дерева: " | ||
n = gets.chomp.to_i | ||
print "Введите базовый номер: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
line.push(line[k].to_i * (n-k) / (k+1)) | ||
end | ||
return line | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
for k in 0...n | ||
line.push(line[k].to_i * (n-k) / (k+1)) | ||
end | ||
return line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
Redundant return detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
line = [number] | ||
for k in 0...n | ||
line.push(line[k].to_i * (n-k) / (k+1)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
def pascal(n, number) | ||
line = [number] | ||
for k in 0...n | ||
line.push(line[k].to_i * (n-k) / (k+1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 4) spaces for indentation.
Surrounding space missing for operator -.
Surrounding space missing for operator +.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
@@ -0,0 +1,25 @@ | |||
def pascal(n, number) | |||
line = [number] | |||
for k in 0...n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer each over for.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
|
||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i, number)}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
Final newline missing.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
print 'Введите базовый номер: ' | ||
number = gets.chomp.to_i | ||
|
||
for i in 0...n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer each over for.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
|
||
def format_pascal(n, number) | ||
col = `/usr/bin/tput cols`.chomp.to_i | ||
pascal(n,number).to_s.center(col) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after comma.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
end | ||
|
||
def format_pascal(n, number) | ||
col = `/usr/bin/tput cols`.chomp.to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
for k in 0...n | ||
line.push (line[k] .to_i * (n - k) / (k + 1)) | ||
end | ||
return line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant return detected.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
def pascal(n, number) | ||
line = [number] | ||
for k in 0...n | ||
line.push (line[k] .to_i * (n - k) / (k + 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 4) spaces for indentation.
(...) interpreted as grouped expression.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
number = gets.chomp.to_i | ||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i, number)}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
print 'Введите базовый номер: ' | ||
number = gets.chomp.to_i | ||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i, number)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Tab detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
n = gets.chomp.to_i | ||
print 'Введите базовый номер: ' | ||
number = gets.chomp.to_i | ||
for i in 0...n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer each over for.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
|
||
def format_pascal(n, number) | ||
col = `/usr/bin/tput cols`.chomp.to_i | ||
pascal(n, number).to_s.center(col) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
end | ||
|
||
def format_pascal(n, number) | ||
col = `/usr/bin/tput cols`.chomp.to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Tab detected.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
for k in 0...n | ||
line.push (line[k].to_i * (n - k) / (k + 1)) | ||
end | ||
line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
line = [number] | ||
for k in 0...n | ||
line.push (line[k].to_i * (n - k) / (k + 1)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
def pascal(n, number) | ||
line = [number] | ||
for k in 0...n | ||
line.push (line[k].to_i * (n - k) / (k + 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
Use 2 (not 1) spaces for indentation.
(...) interpreted as grouped expression.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
@@ -0,0 +1,20 @@ | |||
def pascal(n, number) | |||
line = [number] | |||
for k in 0...n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
Prefer each over for.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
@@ -0,0 +1,20 @@ | |||
def pascal(n, number) | |||
line = [number] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Tab detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
number = gets.chomp.to_i | ||
|
||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i, number)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Tab detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
end | ||
|
||
def format_pascal(n, number) | ||
col = `/usr/bin/tput cols`.chomp.to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
line = [number] | ||
|
||
for k in 0...n | ||
line.push (line[k].to_i * (n - k) / (k + 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(...) interpreted as grouped expression.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
def pascal(n, number) | ||
line = [number] | ||
|
||
for k in 0...n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer each over for.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
@@ -0,0 +1,23 @@ | |||
def pascal(n, number) | |||
line = [number] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
number = gets.chomp.to_i | ||
for i in 0...n | ||
puts "#{i}: #{format_pascal(i, number)}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
line | ||
end | ||
def format_pascal(n, number) | ||
col = `/usr/bin/tput cols`.chomp.to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/SaliankoRuslan/1/pascal_tree.rb
Outdated
end | ||
line | ||
end | ||
def format_pascal(n, number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use empty lines between method definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мелкие фиксы, в остальном норм.
@@ -0,0 +1,20 @@ | |||
def pascal(n, number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я уверен, что n можно как-то обозвать более читаемо.
def pascal(n, number) | ||
line = [number] | ||
n.times do |k| | ||
line << (line[k].to_i * (n - k) / (k + 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и k это тоже касается
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Именую методы и переменные более читаемо, в остальном нормально.
Фамилия Имя
Руслан Салянко
Email
[email protected]
Номер домашнего задания
1
Ссылка на видео с демо работы
https://youtu.be/HEam66d9k5s
Комментарии
Не доделал, что бы красиво выводилась