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 7 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
17 changes: 17 additions & 0 deletions 2018/YuryKravchenko/homework-1/pascal_tree.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def pascal(n)
print 'Введите базовый номер: '
f = gets.chomp.to_i
Copy link
Contributor

Choose a reason for hiding this comment

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

имена переменных прям очень плохие

h = f
(0..n).each { |r|
Copy link
Contributor

Choose a reason for hiding this comment

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

зачем этот отступ?

Copy link
Contributor

Choose a reason for hiding this comment

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

используй do end вместо { } для многострочных блоков.

Copy link
Contributor

Choose a reason for hiding this comment

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

n.times do |r|

tree = [h]
base = f
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.

(0..r - 1).step(1) { |index|
Copy link
Contributor

Choose a reason for hiding this comment

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

(0...r).each do

base = base * ( r - k + 1 ) / k
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, 13 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, 13 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)