-
Notifications
You must be signed in to change notification settings - Fork 102
Lesson 4 (+1cm fix) #181
Lesson 4 (+1cm fix) #181
Conversation
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.
Все довольно неплохо, исправляйте замечания и можно работать дальше
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int): Double = TODO() | ||
fun lengthInMeters(sagenes: Int, arshins: Int, vershoks: Int) : Double = | ||
((vershoks * 4.445 + arshins * 16* 4.445 + sagenes * 48* 4.445) / 100) |
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.
Лишние скобки вокруг законченного выражения
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun angleInRadian(grad: Int, min: Int, sec: Int): Double = TODO() | ||
fun angleInRadian(grad: Int, min: Int, sec: Int): Double = | ||
(( grad +(( min + sec / 60.0) /60.0)) * Math.PI /180) |
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.
Почему здесь открывающие скобки внезапно испугались и отделились от остальных частей пробелами?
src/lesson1/task1/Simple.kt
Outdated
* Определить третью цифру справа в этом числе (в данном случае 8). | ||
*/ | ||
fun thirdDigit(number: Int): Int = TODO() | ||
fun thirdDigit(number: Int) = (number/100)%10 |
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.
Пожалуйста, старайтесь придерживаться единого стиля кодирования везде. Представьте, что за вашим кодом следит психопат с обсессивно-компульсивным синдромом по поводу правильного форматирования кода и что он знает, где вы живете.
src/lesson1/task1/Simple.kt
Outdated
fun accountInThreeYears(initial: Int, percent: Int): Double = TODO() | ||
fun accountInThreeYears(initial: Int, percent: Int): Double { | ||
val k = initial + initial*0.01*percent | ||
return (k + k*0.01*percent) + (k + k*0.01*percent)*0.01*percent |
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.
Это выражение можно упростить еще дальше
src/lesson2/task1/IfElse.kt
Outdated
fun ageDescription(age: Int): String = TODO() | ||
|
||
fun ageDescription(age: Int): String { | ||
if ((age / 10) % 10 == 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.
Этот if
может быть частью следующего за ним when
src/lesson4/task1/List.kt
Outdated
*/ | ||
fun center(list: MutableList<Double>): MutableList<Double> = TODO() | ||
fun center(list: MutableList<Double>): MutableList<Double> { | ||
if (list.isEmpty()) return list |
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.
Зачем эта проверка?
src/lesson4/task1/List.kt
Outdated
fun times(a: List<Double>, b: List<Double>): Double = TODO() | ||
fun times(a: List<Double>, b: List<Double>): Double { | ||
if (a.isEmpty() || b.isEmpty()) return 0.0 | ||
var C = 0.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.
Называть переменные с большой буквы в Котлине не принято
src/lesson4/task1/List.kt
Outdated
*/ | ||
fun polynom(p: List<Double>, x: Double): Double = TODO() | ||
fun polynom(p: List<Double>, x: Double): Double { | ||
if (p.isEmpty()) return 0.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.
Зачем эта проверка?
src/lesson4/task1/List.kt
Outdated
*/ | ||
fun accumulate(list: MutableList<Double>): MutableList<Double> = TODO() | ||
fun accumulate(list: MutableList<Double>): MutableList<Double> { | ||
var Z = 0.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.
- Называть переменные с большой буквы в Котлине не принято
- Переменным лучше давать осмысленные имена, соответствующие их назначению в коде
src/lesson4/task1/List.kt
Outdated
val result = mutableListOf<Int>() | ||
var n0 = n | ||
while (n0 > 1) { | ||
result.add(minDivisor(n0)) |
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.
Повторно используемые выражения (тем более, содержащие вызовы тяжелых функций) следует вынести в отдельные переменные
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.
Извините, но я плохо понимаю, как это можно исправить, ведь переменная, которая вызывается в тяжелой функции, меняется в цикле ;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.
А что вам мешает определить эту переменную прямо в цикле?
Я не могу загрузить изменения из-за ошибки, что делать? Push failed |
Можете приложить лог идеи ( |
А давайте вы теперь снова попробуете сделать Git push и покажете новый лог после этого |
Попробуйте переуказать ваши данные для GitHub и попробуйте снова |
Не помогло :с |
А если открыть консоль и попробовать сделать |
Я через консоль могу зайти в папку, но что делать дальше? |
Дальше попробовать выполнить |
Запустите CRD в режиме шаринга и скиньте мне Access Code на почту |
recheck all |
authorVera [veramagical@mail.ru] lesson1.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 12 / 12 Example: 4 / 4 Succeeded:
Seed: -4893617655541378991 lesson2.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 7 / 7 Example: 1 / 1 Succeeded:
Seed: -4893617655541378991 lesson2.task2Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 5 / 5 Example: 1 / 1 Succeeded:
Seed: -4893617655541378991 lesson3.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 16 / 18 Example: 4 / 4 Succeeded:
Seed: -4893617655541378991 lesson4.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 18 / 21 Example: 7 / 7 Succeeded:
Seed: -4893617655541378991 lesson5.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 7 / 12 Example: 2 / 2 Succeeded:
Failed:
Seed: -4893617655541378991 lesson6.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 14 / 16 Example: 4 / 4 Succeeded:
Seed: -4893617655541378991 lesson7.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 3 / 3 Easy: 1 / 1 Succeeded:
Seed: -4893617655541378991 lesson7.task2Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 4 / 15 Example: 2 / 2 Succeeded:
Seed: -4893617655541378991 lesson8.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 2 / 13 Example: 1 / 1 Succeeded:
Seed: -4893617655541378991 ownerKamikoFuroraru [] totalAuthor: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 92 / 136 Example: 30 / 30 |
Checkme!! |
|
||
override fun set(row: Int, column: Int, value: E) { | ||
TODO() | ||
map[Pair(row, column)] = value |
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.
Почему мы не проверяем возможность выхода за границы?
src/lesson7/task2/Matrices.kt
Outdated
row > 0 -> result[row - 1, column] | ||
column > 0 -> result[row, column - 1] | ||
else -> 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.
Чтобы не делать when
в подобных случаях, обычно отдельным циклом проходятся по первой строке/столбцу матрицы, а потом уже идут вглубь
src/lesson8/task1/Files.kt
Outdated
TODO() | ||
val result = mutableMapOf<String, Int>() | ||
for (line in File(inputName).readLines()) { | ||
for (string in substrings) { |
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.
Ужасное имя переменной
src/lesson8/task1/Files.kt
Outdated
val result = mutableMapOf<String, Int>() | ||
for (line in File(inputName).readLines()) { | ||
for (string in substrings) { | ||
val parts = line.toLowerCase().split(string.toLowerCase()) |
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.
Более правильно сделать это через String.findAnyOf
src/lesson8/task1/Files.kt
Outdated
if (parts.isNotEmpty()) { | ||
if (!result.contains(string)) | ||
result.put(string, parts.size - 1) | ||
else result.set(string, result.get(string)!! + parts.size -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.
Лучше вместо всего этого использовать Map.getOrElse
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.
У вас осталось минимум замечаний и один неработающий тест. Задач вы сделали много, а значит, близки к отличной оценке :)
src/lesson5/task1/Parse.kt
Outdated
*/ | ||
fun flattenPhoneNumber(phone: String): String = TODO() | ||
fun flattenPhoneNumber(phone: String): String = | ||
if (phone.matches(Regex("""[\d\s()+-]+"""))) phone.filter { it !in "()- " } |
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.
Есть ощущение, что это может работать неправильно, например, для phone = "\t"
(табуляция). Табуляция с точки зрения рег-экса является пробельным символом, но не будет отфильтрована.
authorVera [veramagical@mail.ru] lesson5.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 7 / 12 Example: 2 / 2 Succeeded:
Failed:
Seed: -1365990444068290564 lesson7.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 3 / 3 Easy: 1 / 1 Succeeded:
Seed: -1365990444068290564 ownerKamikoFuroraru [] totalAuthor: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 10 / 15 Example: 2 / 2 |
authorVera [veramagical@mail.ru] lesson5.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 7 / 12 Example: 2 / 2 Succeeded:
Failed:
Seed: -5110936655025082610 ownerKamikoFuroraru [] totalAuthor: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 7 / 12 Example: 2 / 2 |
Я отметила не то, что хотела, поэтому так отправилось. Ещё переделываю |
authorVera [veramagical@mail.ru] lesson5.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 7 / 12 Example: 2 / 2 Succeeded:
Failed:
Seed: -4162221166409148318 ownerKamikoFuroraru [] totalAuthor: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 14 / 24 Example: 4 / 4 |
authorVera [veramagical@mail.ru] lesson5.task1Author: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 8 / 12 Example: 2 / 2 Succeeded:
Seed: 1773053797181758125 ownerKamikoFuroraru [] totalAuthor: Vera [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 16 / 24 Example: 4 / 4 |
authorKamikoFuroraru [veramagical@mail.ru] lesson7.task2Author: KamikoFuroraru [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 4 / 15 Example: 2 / 2 Succeeded:
Seed: 337912620458649778 ownerKamikoFuroraru [] totalAuthor: KamikoFuroraru [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 4 / 15 Example: 2 / 2 |
authorKamikoFuroraru [veramagical@mail.ru] lesson8.task1Author: KamikoFuroraru [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 2 / 13 Example: 1 / 1 Succeeded:
Seed: 6975900727316051426 ownerKamikoFuroraru [] totalAuthor: KamikoFuroraru [veramagical@mail.ru] Owner: KamikoFuroraru [] Total: 2 / 13 Example: 1 / 1 |
Я люблю программирование!! |
Спасибо. |
No description provided.