-
Notifications
You must be signed in to change notification settings - Fork 102
Lesson 2 tast 1 #87
Lesson 2 tast 1 #87
Conversation
Обратите внимание, что ваш код даже не собирается. Убедительная просьба проверять, что встроенные в проект тесты проходят, перед отправкой PR. |
Lesson 2 Tasks 1,2
Ваш код все еще не собирается |
Автору PR: вы сильно отстаёте от графика. Вам следует исправить ошибку компиляции и перейти к решению задач 2-го и 3-го урока, в противном случае вы рискуете получить неудовлетворительную оценку за октябрь месяц. |
Lesson 3 Task 1 Lesson 4 Task 1 Ex. 1 and 2
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
* Рассчитать время в секундах, прошедшее с начала суток (30035 в данном случае). | ||
*/ | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int = TODO() | ||
fun seconds(hours: Int, minutes: Int, seconds: Int): Int = (hours * 3600 + minutes * 60 + seconds) |
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
* Вывести значение того же угла в радианах (например, 0.63256). | ||
*/ | ||
fun angleInRadian(grad: Int, min: Int, sec: Int): Double = TODO() | ||
fun angleInRadian(grad: Int, min: Int, sec: Int): Double = (grad + min/60.0 + sec/3600.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.
Форматирование кода должно быть одинаковым везде. Либо отделяете штуки друг от друга пробелами, либо не отделяете. Попробуйте отформатировать код при помощи IntelliJ IDEA и в дальнейшем придерживайтесь такого же стиля.
src/lesson1/task1/Simple.kt
Outdated
* Например, расстояние между (3, 0) и (0, 4) равно 5 | ||
*/ | ||
fun trackLength(x1: Double, y1: Double, x2: Double, y2: Double): Double = TODO() | ||
fun trackLength(x1: Double, y1: Double, x2: Double, y2: Double): Double = sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))) |
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 = | ||
(((initial+initial*percent/100.0)+(initial+initial*percent/100.0)*percent/100.0)+((initial+initial*percent/100.0)+(initial+initial*percent/100.0)*percent/100.0)*percent/100.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/lesson2/task1/IfElse.kt
Outdated
fun ageDescription(age: Int): String = TODO() | ||
fun ageDescription(age: Int): String = | ||
when { | ||
(age % 10) == (1) -> ("$age год") |
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.
Очень много лишних скобок
fun lcm(m: Int, n: Int): Int { | ||
var k = 1 | ||
while ((k < m) || (k < n)) { | ||
k++ |
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.
Почему не просто Math.max(...)
или if
???
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.
Ап
k++ | ||
} | ||
while (((k % m) !== 0) || ((k % n) !== 0)) { | ||
k++ |
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.
Ап
src/lesson4/task1/List.kt
Outdated
*/ | ||
fun mean(list: List<Double>): Double = TODO() | ||
fun mean(list: List<Double>): Double { | ||
if (list.isEmpty() == true) 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.
return
можно вытащить передif
- Функцию с телом в виде одного
return expr
можно записать какfun foo(...) = expr
if (cond == true) ==> if (cond)
*/ | ||
fun center(list: MutableList<Double>): MutableList<Double> = TODO() | ||
fun center(list: MutableList<Double>): MutableList<Double> { | ||
val averageEqual = list.sum() / list.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.
Что будет, если список пустой?
src/lesson4/task1/List.kt
Outdated
val averageEqual = list.sum() / list.size | ||
for (i in 0..list.size - 1) { | ||
val secondList = list[i] | ||
list[i] = secondList-averageEqual |
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.
Можно list[i] = list[i] - average
Lesson 3 Task 1 Lesson 4 Task 1 Ex. 1 and 2 *corrections
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.
4 урок вам не будет засчитан, так как вы не исправили достаточно серьезные замечания к предыдущим урокам
src/lesson1/task1/Simple.kt
Outdated
*/ | ||
fun accountInThreeYears(initial: Int, percent: Int): Double = TODO() | ||
fun accountInThreeYears(initial: Int, percent: Int): Double = | ||
(((initial + initial * percent / 100.0) + (initial + initial * percent / 100.0) * percent / 100.0) + ((initial + initial * percent / 100.0) + (initial + initial * percent / 100.0) * percent / 100.0) * percent / 100.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/lesson2/task1/IfElse.kt
Outdated
rookX1: Int, rookY1: Int, | ||
rookX2: Int, rookY2: Int): Int = TODO() | ||
rookX2: Int, rookY2: Int): Int { | ||
var treatFromFirst = 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.
- Почему эта переменная имеет тип
Int
, а неBoolean
? threatFromFirst
var treatFromFirst = 0 | ||
var treatFromSecond = 0 | ||
var result = 0 | ||
when { |
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
не будет работать так, как вы хотите. Вы должны сперва в переменные threatFrom*
записать то, атакует ли та или иная ладья короля, а потом уже присваивать соответствующее значение результату в when
.
src/lesson2/task1/IfElse.kt
Outdated
*/ | ||
fun segmentLength(a: Int, b: Int, c: Int, d: Int): Int = TODO() | ||
fun segmentLength(a: Int, b: Int, c: Int, d: Int): Int = | ||
when { |
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.
Форматирование кода
*/ | ||
fun isNumberHappy(number: Int): Boolean = TODO() | ||
fun isNumberHappy(number: Int): Boolean = | ||
if ((((number % 100) / 10) + (number % 10)) == (number / 1000) + ((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.
Выражение if (cond) true else false
можно заменить на cond
fun digitNumber(n: Int): Int = TODO() | ||
fun digitNumber(n: Int): Int { | ||
var count = 0 | ||
var numb = n |
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.
Ап
fun lcm(m: Int, n: Int): Int { | ||
var k = 1 | ||
while ((k < m) || (k < n)) { | ||
k++ |
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.
Ап
k++ | ||
} | ||
while (((k % m) !== 0) || ((k % n) !== 0)) { | ||
k++ |
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.
Ап
*/ | ||
fun mean(list: List<Double>): Double = TODO() | ||
fun mean(list: List<Double>): Double = | ||
if (list.isEmpty() == true) 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.
Зачем ... == true
для переменной типа Boolean
?
fun center(list: MutableList<Double>): MutableList<Double> = TODO() | ||
fun center(list: MutableList<Double>): MutableList<Double> { | ||
if (list.isEmpty() == true) return list | ||
val averageEqual = list.sum() / list.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.
Можно было просто воспользоваться функцией mean(...)
authoregor-abak [egor-abak@mail.ru] lesson1.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 12 / 12 Example: 4 / 4 Succeeded:
Seed: 4505930522167467390 lesson2.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 1 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: 4505930522167467390 lesson2.task2Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 2 / 5 Example: 1 / 1 Succeeded:
Seed: 4505930522167467390 lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 5 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: 4505930522167467390 lesson4.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 9 / 21 Example: 7 / 7 Succeeded:
Seed: 4505930522167467390 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 40 / 136 Example: 28 / 30 |
Вы довольно сильно отстаёте от графика. Вам следует продолжать решать задачи учебного проекта. |
recheck all |
authoregor-abak [egor-abak@mail.ru] lesson1.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 12 / 12 Example: 4 / 4 Succeeded:
Seed: -3209875509518640903 lesson2.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 1 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: -3209875509518640903 lesson2.task2Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 2 / 5 Example: 1 / 1 Succeeded:
Seed: -3209875509518640903 lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 5 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: -3209875509518640903 lesson4.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 9 / 21 Example: 7 / 7 Succeeded:
Seed: -3209875509518640903 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 40 / 136 Example: 28 / 30 |
В настоящее время у вас нет даже зачета по нашему курсу. |
authoregor-abak [egor-abak@mail.ru] lesson1.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 12 / 12 Example: 4 / 4 Succeeded:
Seed: 7743546936697989149 lesson2.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 2 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: 7743546936697989149 lesson2.task2Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 3 / 5 Example: 1 / 1 Succeeded:
Failed:
Seed: 7743546936697989149 lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 6 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: 7743546936697989149 lesson4.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 10 / 21 Example: 7 / 7 Succeeded:
Failed:
Seed: 7743546936697989149 lesson5.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 4 / 12 Example: 2 / 2 Succeeded:
Seed: 7743546936697989149 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 37 / 75 Example: 19 / 19 |
Вы можете расслабиться до дополнительной сессии, Егор. Дедлайн уже прошел. |
authoregor-abak [egor-abak@mail.ru] lesson1.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 12 / 12 Example: 4 / 4 Succeeded:
Seed: 667549392051604886 lesson2.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 3 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: 667549392051604886 lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 7 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: 667549392051604886 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 22 / 37 Example: 9 / 9 |
recheck all |
authoregor-abak [egor-abak@mail.ru] lesson1.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 12 / 12 Example: 4 / 4 Succeeded:
Seed: -4583317203678741055 lesson2.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 3 / 7 Example: 1 / 1 Succeeded:
Failed:
Seed: -4583317203678741055 lesson2.task2Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 3 / 5 Example: 1 / 1 Succeeded:
Failed:
Seed: -4583317203678741055 lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 7 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: -4583317203678741055 lesson4.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 10 / 21 Example: 7 / 7 Succeeded:
Failed:
Seed: -4583317203678741055 lesson5.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 4 / 12 Example: 2 / 2 Succeeded:
Seed: -4583317203678741055 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 48 / 136 Example: 28 / 30 |
authoregor-abak [egor-abak@mail.ru] lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 8 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: -7527787416100889930 lesson4.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 11 / 21 Example: 7 / 7 Succeeded:
Seed: -7527787416100889930 lesson5.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 5 / 12 Example: 2 / 2 Succeeded:
Failed:
Seed: -7527787416100889930 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 29 / 63 Example: 15 / 15 |
authoregor-abak [egor-abak@mail.ru] lesson3.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 8 / 18 Example: 4 / 4 Succeeded:
Failed:
Seed: 3312554310787434115 lesson4.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 11 / 21 Example: 7 / 7 Succeeded:
Seed: 3312554310787434115 lesson5.task1Author: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 5 / 12 Example: 2 / 2 Succeeded:
Failed:
Seed: 3312554310787434115 owneregor-abak [] totalAuthor: egor-abak [egor-abak@mail.ru] Owner: egor-abak [] Total: 29 / 63 Example: 15 / 15 |
No description provided.