Skip to content
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 #768

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions 2018/YuryKravchenko/homework-1/pascal_tree.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# My Homework
def pascal(n)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation of first line in file detected.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation of first line in file detected.

print 'Введите базовый номер: '
f = gets.chomp.to_i
h = f
(0..n).each { |r|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.
Avoid using {...} for multi-line blocks.

tree = [h]
base = f
k = 1
(0..r - 1).step(1) { |index|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.
Avoid using {...} for multi-line blocks.
Unused block argument - index. You can omit the argument if you don't care about it.

base = base * ( r - k + 1 ) / k

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside parentheses detected.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside parentheses detected.

tree.push base
k += 1}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.
Expression at 13, 15 should be on its own line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.
Expression at 12, 15 should be on its own line.

p tree}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expression at 13, 11 should be on its own line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expression at 13, 11 should be on its own line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.
Expression at 14, 11 should be on its own line.

end
print 'Введите глубину дерева: '
n = gets.chomp.to_i
pascal(n)