Skip to content

homework 1#763

Open
YuliyaBond wants to merge 1 commit intorubyroidlabs:masterfrom
YuliyaBond:homework-1
Open

homework 1#763
YuliyaBond wants to merge 1 commit intorubyroidlabs:masterfrom
YuliyaBond:homework-1

Conversation

@YuliyaBond
Copy link
Copy Markdown

@YuliyaBond YuliyaBond commented Feb 19, 2018

Фамилия Имя

Бондарева Юля

Email

y.d.bondareva@inbox.ru

Номер домашнего задания

1

Ссылка на видео с демо работы

https://www.youtube.com/watch?v=FW_AysccL-M

Комментарии

сделала 3 задания

puts 'BASE and depth must be positive. '
exit
end
tree(number.to_i,base_number.to_i)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Space missing after comma.

puts "Depth?"
number = gets.chomp
base_number = ENV['BASE']
if number.to_i <= 0 || number.nil? || base_number.to_i <=0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Surrounding space missing for operator <=.

}
end

puts "Depth?"
Copy link
Copy Markdown

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.

else
puts "#{i+1}:" + "#{str}".center(pr[1].to_i)
end
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

} at 26, 4 is not aligned with (0...n).each{ |i| at 6, 2.

puts "#{i+1}:" + "#{str}".center(pr[1].to_i)
puts" " + "#{str_end} \\".center(pr[1].to_i)
else
puts "#{i+1}:" + "#{str}".center(pr[1].to_i)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Move puts "#{i+1}:" + "#{str}".center(pr[1].to_i) out of the conditional.
Surrounding space missing for operator +.
Prefer to_s over string interpolation.

str2 = [' /']
str1 = ' /'
(0...i).each{|j|
temp = temp * (i - s + 1)/s
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use 2 (not 0) spaces for indentation.
Surrounding space missing for operator /.

s = 1
str2 = [' /']
str1 = ' /'
(0...i).each{|j|
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Space missing to the left of {.
Space between { and | missing.
Avoid using {...} for multi-line blocks.
Unused block argument - j. You can omit the argument if you don't care about it.

puts "Pascal triangle".center(pr[1].to_i)
(0...n).each{ |i|
trn=[base_number]
temp=base_number
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Surrounding space missing for operator =.

pr= TermInfo.screen_size
puts "Pascal triangle".center(pr[1].to_i)
(0...n).each{ |i|
trn=[base_number]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use 2 (not 0) spaces for indentation.
Surrounding space missing for operator =.

def tree(n,base_number)
pr= TermInfo.screen_size
puts "Pascal triangle".center(pr[1].to_i)
(0...n).each{ |i|
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Space missing to the left of {.
Avoid using {...} for multi-line blocks.

else
puts "#{i+1}:" + "#{str}".center(pr[1].to_i)
end
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

} at 26, 4 is not aligned with (0...n).each { |i| at 6, 2.

trn.push temp
s += 1
str2.push str1
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

} at 17, 6 is not aligned with (0...i).each { at 12, 4.

str2 = [' /']
str1 = ' /'
(0...i).each {
temp = temp * ((i - s + 1) / s)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use 2 (not 0) spaces for indentation.
Use self-assignment shorthand *=.


def tree(n,base_number)
pr = TermInfo.screen_size
puts "Pascal triangle".center(pr[1].to_i)
Copy link
Copy Markdown

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.

}
str = trn.join(' ')
str_end = str2.join(' \\')
puts "#{i + 1}:" + "#{str.to_s}".center(pr[1].to_i)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Prefer to_s over string interpolation.
Redundant use of Object#to_s in interpolation.
Trailing whitespace detected.

k = 0
str2 = [' /']
str1 = ' /'
(0...i).each {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Avoid using {...} for multi-line blocks.

trn = [base_number]
temp = base_number
s = 1
k = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Useless assignment to variable - k.

str2 = [' /']
str1 = ' /'
(0...i).each do
temp = ( (temp * (i - s + 1)) / s )
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Space inside parentheses detected.

trn = [base_number]
temp = base_number
s = 1
c = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Useless assignment to variable - c.

s += 1
str2.push str1
end
c = 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Useless assignment to variable - c.

Copy link
Copy Markdown
Contributor

@Xanderwot Xanderwot left a comment

Choose a reason for hiding this comment

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

В основном замечание по именам переменных

def tree(n, base_number)
pr = TermInfo.screen_size
puts 'Pascal triangle'.center(pr[1].to_i)
(0...n).each do |i|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

n.times do

require 'terminfo'

def tree(n, base_number)
pr = TermInfo.screen_size
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

очень плохое имя для переменной и ниже тоже это прослеживается

s = 1
str2 = [' /']
str1 = ' /'
(0...i).each do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

times

number = gets.chomp
base_number = ENV['BASE']
if number.to_i <= 0 || number.nil? || base_number.to_i <= 0
puts 'BASE and depth must be positive. '
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

я считаю что в данном случае лучше райзить ошибку, нежели просто завершать выполнение программы

puts 'Depth?'
number = gets.chomp
puts 'BASE?'
base_number = gets.chomp
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Trailing whitespace detected.

puts 'Depth?'
number = gets.chomp
base_number = ENV['BASE']
while number.to_i <= 0 || number.nil? || base_number.to_i <= 0 do
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do not use do with multi-line while.

s += 1
branch.push ' /'
end
arrToStr = trn.join(' ')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use snake_case for variable names.

number = gets.chomp

end
while base_number.to_i <= 0 do
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do not use do with multi-line while.

base_number = gets.chomp
end
tree(number.to_i, base_number.to_i)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 trailing blank lines detected.

break if number.to_i > 0
end
end
if base_number.to_i <=0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Surrounding space missing for operator <=.

puts 'Depth?'
number = gets.chomp
base_number = ENV['BASE']
if number.to_i <= 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Trailing whitespace detected.

base_number = gets.chomp
break if base_number.to_i > 0
end
end
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unexpected token kEND

break if number.to_i > 0
end
end
if base_number.to_i < =0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unexpected token tEQL

number = gets.chomp
break if number.to_i > 0
end
end
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unexpected token kEND

puts 'Depth?'
number = gets.chomp
base_number = ENV['BASE']
if number.to_i < = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unexpected token tEQL

new homework 1

corrected homework 1

corrected-new homework 1

corrected-new1 homework 1

corrected-new2 homework 1

corrected-new3 homework 1

corrected-new4 homework 1

corrected-new5 homework 1

corrected-new6 homework 1

corrected-new7 homework 1

right i homework 1

right i homework 1

right i homework 1

corrected

commit1

commit2

corrected

corrected1

corrected

corrected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants