Предмет: Информатика, автор: ihoretpipenko

def ranger(speed_sheep: int = 0) -> dict:
for star in stars:
range_time = star[1]/speed_sheep
print(star[0], range_time)

if range_time > 10:
print("no")

else: range_time < 9;
print("yes")

ranger(5000000)



naidi osibky

Ответы

Автор ответа: antonkovalkin5
1

Ответ:

1. Отсутствует объявление переменной `stars`, которую используется в цикле `for`. Необходимо предварительно определить или инициализировать переменную `stars`.

2. Отсутствуют отступы для блоков кода внутри функции `ranger`. В Python отступы являются важным синтаксическим элементом и определяют блоки кода. Необходимо добавить отступы для строк, находящихся внутри функции `ranger`.

3. В условии `else` присутствует некорректное выражение `range_time < 9;`. Вместо точки с запятой `;` следует использовать двоеточие `:` для обозначения начала блока кода. Кроме того, условие `range_time < 9` в данном случае излишне, так как предыдущее условие `range_time > 10` уже проверяет все остальные случаи. Можно просто использовать `else:` без условия.

Исправленный вариант кода:

def ranger(speed_sheep: int = 0) -> None:

stars = [("Star A", 100), ("Star B", 200), ("Star C", 300)] # Пример инициализации переменной stars

for star in stars:

range_time = star[1] / speed_sheep

print(star[0], range_time)

if range_time > 10:

print("no")

else:

print("yes")

ranger(5000000).


ihoretpipenko: no ja rabotay v Jupitere
ihoretpipenko: stars koroche v drugom bloke
Похожие вопросы
Предмет: Английский язык, автор: jdid61ky
PRESENT PERFECT / PRESENT PERFECT CONTINUOUS Complete the sentences using Present Perfect or Present Perfect Continuous: 1. 1 (to count bicycles). One is missing. 2. The doctor (to examine) my injured arm. Thanks God, it isn't broken. 3. Her phone (to ring) for ten minutes. It annoys me. 4. They (to build) this bridge for two years. There's mud and mess around. 5. We (to walk) ten kilometers. We are so exhausted! That boy (to eat) four ice-creams. Don't give him more. 1 (not to talk) with him yet. 8. He (to sleep) since ten o'clock, it's time he woke up. 9. It (to rain) for two days now, there will be flood soon. 6. 7. 10. Ann (not to do) anything to stop her friends gossiping. 11. We (to live) here since 1997. 12. 1 (to drive) for ten years. 13. He (to teach) in this school for five years. 14. I (to teach) hundreds of students but I never (to meet) such a hopeless group. 15. John and Jack (to argue) since the early morning. 16. We (to hear) the news: Tom and Jill are engaged! 17. Stop babbling, I (to try) to finish this letter for the last half-hour. 18. I (to tidy up) my room all the morning, but Mum isn't satisfied yet. 19. My aunt (to work) as an accountant since I remember. 20. They (to live) in France since 1990. 21.1 (to buy) a new carpet. Come and look at it. 22. Someone (to take) my phone. 23. Frank and Sally (to discuss) these matters for an hour or so. They can't stop. 24. We (to miss) the bus. Now we'll have to walk. 25. Don't come in. I just (to wash) this floor. 26. He (not to stop) eating since he arrived. 27. Scientists (to work out) on the solution to the problem of pollution since early 70' 28. He (to be) Minister of Education since 1983. 29. 1 (to shop) all day and I haven't a cent left. Where is she? for an​
Предмет: Геометрия, автор: andruggg
Предмет: Алгебра, автор: anaandusak
Предмет: Алгебра, автор: vityamath