-
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
homework 1 #763
base: master
Are you sure you want to change the base?
homework 1 #763
Conversation
puts 'BASE and depth must be positive. ' | ||
exit | ||
end | ||
tree(number.to_i,base_number.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.
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 |
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.
Surrounding space missing for operator <=.
} | ||
end | ||
|
||
puts "Depth?" |
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.
else | ||
puts "#{i+1}:" + "#{str}".center(pr[1].to_i) | ||
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.
} 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) |
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.
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 |
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 0) spaces for indentation.
Surrounding space missing for operator /.
s = 1 | ||
str2 = [' /'] | ||
str1 = ' /' | ||
(0...i).each{|j| |
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 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 |
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.
Surrounding space missing for operator =.
pr= TermInfo.screen_size | ||
puts "Pascal triangle".center(pr[1].to_i) | ||
(0...n).each{ |i| | ||
trn=[base_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 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| |
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 to the left of {.
Avoid using {...} for multi-line blocks.
else | ||
puts "#{i+1}:" + "#{str}".center(pr[1].to_i) | ||
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.
} at 26, 4 is not aligned with (0...n).each { |i| at 6, 2.
trn.push temp | ||
s += 1 | ||
str2.push str1 | ||
} |
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.
} at 17, 6 is not aligned with (0...i).each { at 12, 4.
str2 = [' /'] | ||
str1 = ' /' | ||
(0...i).each { | ||
temp = temp * ((i - s + 1) / s) |
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 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) |
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.
} | ||
str = trn.join(' ') | ||
str_end = str2.join(' \\') | ||
puts "#{i + 1}:" + "#{str.to_s}".center(pr[1].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.
Prefer to_s over string interpolation.
Redundant use of Object#to_s in interpolation.
Trailing whitespace detected.
k = 0 | ||
str2 = [' /'] | ||
str1 = ' /' | ||
(0...i).each { |
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.
Avoid using {...} for multi-line blocks.
trn = [base_number] | ||
temp = base_number | ||
s = 1 | ||
k = 0 |
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.
Useless assignment to variable - k.
str2 = [' /'] | ||
str1 = ' /' | ||
(0...i).each do | ||
temp = ( (temp * (i - s + 1)) / s ) |
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 inside parentheses detected.
trn = [base_number] | ||
temp = base_number | ||
s = 1 | ||
c = 0 |
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.
Useless assignment to variable - c.
s += 1 | ||
str2.push str1 | ||
end | ||
c = 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.
Useless assignment to variable - c.
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.
В основном замечание по именам переменных
def tree(n, base_number) | ||
pr = TermInfo.screen_size | ||
puts 'Pascal triangle'.center(pr[1].to_i) | ||
(0...n).each do |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.
n.times do
require 'terminfo' | ||
|
||
def tree(n, base_number) | ||
pr = TermInfo.screen_size |
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.
очень плохое имя для переменной и ниже тоже это прослеживается
s = 1 | ||
str2 = [' /'] | ||
str1 = ' /' | ||
(0...i).each do |
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.
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. ' |
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.
я считаю что в данном случае лучше райзить ошибку, нежели просто завершать выполнение программы
puts 'Depth?' | ||
number = gets.chomp | ||
puts 'BASE?' | ||
base_number = gets.chomp |
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.
puts 'Depth?' | ||
number = gets.chomp | ||
base_number = ENV['BASE'] | ||
while number.to_i <= 0 || number.nil? || base_number.to_i <= 0 do |
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.
Do not use do with multi-line while.
s += 1 | ||
branch.push ' /' | ||
end | ||
arrToStr = trn.join(' ') |
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 snake_case for variable names.
number = gets.chomp | ||
|
||
end | ||
while base_number.to_i <= 0 do |
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.
Do not use do with multi-line while.
base_number = gets.chomp | ||
end | ||
tree(number.to_i, base_number.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.
1 trailing blank lines detected.
break if number.to_i > 0 | ||
end | ||
end | ||
if base_number.to_i <=0 |
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.
Surrounding space missing for operator <=.
puts 'Depth?' | ||
number = gets.chomp | ||
base_number = ENV['BASE'] | ||
if number.to_i <= 0 |
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.
base_number = gets.chomp | ||
break if base_number.to_i > 0 | ||
end | ||
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.
unexpected token kEND
break if number.to_i > 0 | ||
end | ||
end | ||
if base_number.to_i < =0 |
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.
unexpected token tEQL
number = gets.chomp | ||
break if number.to_i > 0 | ||
end | ||
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.
unexpected token kEND
puts 'Depth?' | ||
number = gets.chomp | ||
base_number = ENV['BASE'] | ||
if number.to_i < = 0 |
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.
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
Фамилия Имя
Бондарева Юля
Email
[email protected]
Номер домашнего задания
1
Ссылка на видео с демо работы
https://www.youtube.com/watch?v=FW_AysccL-M
Комментарии
сделала 3 задания