Помогите решить задачу по Python: Напишите функцию number_in_english(number), которая принимает число от 0 до 999, а возвращает строку, в которой это число записано словами на английском языке. Пример работы функции: number_in_english(3) # => three number_in_english(78) # => seventy eight number_in_english(115) # => one hundred and fifteen number_in_english(729) # => seven hundred and twenty nine Пример 1 Ввод print(number_in_english(0).lower()) Вывод zero Пример 2 Ввод print(number_in_english(1).lower()) Вывод one
спасибо, просто времени оч мало поэтому даже над алгоритмом подумать не успеваю)) The post was merged to previous Feb 21, 2020 скорее с словарем
Ну можешь юзать дикт, но концептуально использовать вектор с индексами от 0 до 9 самое легкое и очевидное решение
sesu, Кто-то: юзать дикт неудобно, вектор с индексами от 0 до 9 самое легкое и кон... Я: allnumbers = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty-one ", "twenty-two ", "twenty-three ", "twenty-four ", "twenty-five ", "twenty-six ", "twenty-seven ", "twenty-eight ", "twenty-nine ", "thirty", "thirty-one ", "thirty-two ", "thirty-three ", "thirty-four ", "thirty-five ", "thirty-six ", "thirty-seven ", "thirty-eight ", "thirty-nine ", "forty", "forty-one ", "forty-two ", "forty-three ", "forty-four ", "forty-five ", "forty-six ", "forty-seven ", "forty-eight ", "forty-nine ", "fifty", "fifty-one ", "fifty-two ", "fifty-three ", "fifty-four ", "fifty-five ", "fifty-six ", "fifty-seven ", "fifty-eight ", "fifty-nine ", "sixty", "sixty-one ", "sixty-two ", "sixty-three ", "sixty-four ", "sixty-five ", "sixty-six ", "sixty-seven ", "sixty-eight ", "sixty-nine ", "seventy", "seventy-one ", "seventy-two ", "seventy-three ", "seventy-four ", "seventy-five ", "seventy-six ", "seventy-seven ", "seventy-eight ", "seventy-nine ", "eighty", "eighty-one ", "eighty-two ", "eighty-three ", "eighty-four ", "eighty-five ", "eighty-six ", "eighty-seven ", "eighty-eight ", "eighty-nine ", "ninety", "ninety-one ", "ninety-two ", "ninety-three ", "ninety-four ", "ninety-five ", "ninety-six ", "ninety-seven ", "ninety-eight ", "ninety-nine ", "one hundred", "one hundred and one ", "one hundred and two ", "one hundred and three ", "one hundred and four ", "one hundred and five ", "one hundred and six ", "one hundred and seven ", "one hundred and eight ", "one hundred and nine ", "one hundred and ten ", "one hundred and eleven ", "one hundred and twelve ", "one hundred and thirteen ", "one hundred and fourteen ", "one hundred and fifteen ", "one hundred and sixteen ", "one hundred and seventeen ", "one hundred and eighteen ", "one hundred and nineteen ", "one hundred and twenty ", "one hundred and twenty-one", "one hundred and twenty-two", "one hundred and twenty-three", "one hundred and twenty-four", "one hundred and twenty-five", "one hundred and twenty-six", "one hundred and twenty-seven", "one hundred and twenty-eight", "one hundred and twenty-nine", "one hundred and thirty ", "one hundred and thirty-one", "one hundred and thirty-two", "one hundred and thirty-three", "one hundred and thirty-four", "one hundred and thirty-five", "one hundred and thirty-six", "one hundred and thirty-seven", "one hundred and thirty-eight", "one hundred and thirty-nine", "one hundred and forty ", "one hundred and forty-one", "one hundred and forty-two", "one hundred and forty-three", "one hundred and forty-four", "one hundred and forty-five", "one hundred and forty-six", "one hundred and forty-seven", "one hundred and forty-eight", "one hundred and forty-nine", "one hundred and fifty ", "one hundred and fifty-one", "one hundred and fifty-two", "one hundred and fifty-three", "one hundred and fifty-four", "one hundred and fifty-five", "one hundred and fifty-six", "one hundred and fifty-seven", "one hundred and fifty-eight", "one hundred and fifty-nine", "one hundred and sixty ", "one hundred and sixty-one", "one hundred and sixty-two", "one hundred and sixty-three", "one hundred and sixty-four", "one hundred and sixty-five", "one hundred and sixty-six", "one hundred and sixty-seven", "one hundred and sixty-eight", "one hundred and sixty-nine", "one hundred and seventy ", "one hundred and seventy-one", "one hundred and seventy-two", "one hundred and seventy-three", "one hundred and seventy-four", "one hundred and seventy-five", "one hundred and seventy-six", "one hundred and seventy-seven", "one hundred and seventy-eight", "one hundred and seventy-nine", "one hundred and eighty ", "one hundred and eighty-one", "one hundred and eighty-two", "one hundred and eighty-three", "one hundred and eighty-four", "one hundred and eighty-five", "one hundred and eighty-six", "one hundred and eighty-seven", "one hundred and eighty-eight", "one hundred and eighty-nine", "one hundred and ninety ", "one hundred and ninety-one", "one hundred and ninety-two", "one hundred and ninety-three", "one hundred and ninety-four", "one hundred and ninety-five", "one hundred and ninety-six", "one hundred and ninety-seven", "one hundred and ninety-eight", "one hundred and ninety-nine", "two hundred", "two hundred and one ", "two hundred and two ", "two hundred and three ", "two hundred and four ", "two hundred and five ", "two hundred and six ", "two hundred and seven ", "two hundred and eight ", "two hundred and nine ", "two hundred and ten ", "two hundred and eleven ", "two hundred and twelve ", "two hundred and thirteen ", "two hundred and fourteen ", "two hundred and fifteen ", "two hundred and sixteen ", "two hundred and seventeen ", "two hundred and eighteen ", "two hundred and nineteen ", "two hundred and twenty ", "two hundred and twenty-one", "two hundred and twenty-two", "two hundred and twenty-three", "two hundred and twenty-four", "two hundred and twenty-five", "two hundred and twenty-six", "two hundred and twenty-seven", "two hundred and twenty-eight", "two hundred and twenty-nine", "two hundred and thirty ", "two hundred and thirty-one", "two hundred and thirty-two", "two hundred and thirty-three", "two hundred and thirty-four", "two hundred and thirty-five", "two hundred and thirty-six", "two hundred and thirty-seven", "two hundred and thirty-eight", "two hundred and thirty-nine", "two hundred and forty ", "two hundred and forty-one", "two hundred and forty-two", "two hundred and forty-three", "two hundred and forty-four", "two hundred and forty-five", "two hundred and forty-six", "two hundred and forty-seven", "two hundred and forty-eight", "two hundred and forty-nine", "two hundred and fifty ", "two hundred and fifty-one", "two hundred and fifty-two", "two hundred and fifty-three", "two hundred and fifty-four", "two hundred and fifty-five", "two hundred and fifty-six", "two hundred and fifty-seven", "two hundred and fifty-eight", "two hundred and fifty-nine", "two hundred and sixty ", "two hundred and sixty-one", "two hundred and sixty-two", "two hundred and sixty-three", "two hundred and sixty-four", "two hundred and sixty-five", "two hundred and sixty-six", "two hundred and sixty-seven", "two hundred and sixty-eight", "two hundred and sixty-nine", "two hundred and seventy ", "two hundred and seventy-one", "two hundred and seventy-two", "two hundred and seventy-three", "two hundred and seventy-four", "two hundred and seventy-five", "two hundred and seventy-six", "two hundred and seventy-seven", "two hundred and seventy-eight", "two hundred and seventy-nine", "two hundred and eighty ", "two hundred and eighty-one", "two hundred and eighty-two", "two hundred and eighty-three", "two hundred and eighty-four", "two hundred and eighty-five", "two hundred and eighty-six", "two hundred and eighty-seven", "two hundred and eighty-eight", "two hundred and eighty-nine", "two hundred and ninety ", "two hundred and ninety-one", "two hundred and ninety-two", "two hundred and ninety-three", "two hundred and ninety-four", "two hundred and ninety-five", "two hundred and ninety-six", "two hundred and ninety-seven", "two hundred and ninety-eight", "two hundred and ninety-nine", "three hundred", "three hundred and one ", "three hundred and two ", "three hundred and three ", "three hundred and four ", "three hundred and five ", "three hundred and six ", "three hundred and seven ", "three hundred and eight ", "three hundred and nine ", "three hundred and ten ", "three hundred and eleven ", "three hundred and twelve ", "three hundred and thirteen ", "three hundred and fourteen ", "three hundred and fifteen ", "three hundred and sixteen ", "three hundred and seventeen ", "three hundred and eighteen ", "three hundred and nineteen ", "three hundred and twenty ", "three hundred and twenty-one", "three hundred and twenty-two", "three hundred and twenty-three", "three hundred and twenty-four", "three hundred and twenty-five", "three hundred and twenty-six", "three hundred and twenty-seven", "three hundred and twenty-eight", "three hundred and twenty-nine", "three hundred and thirty ", "three hundred and thirty-one", "three hundred and thirty-two", "three hundred and thirty-three", "three hundred and thirty-four", "three hundred and thirty-five", "three hundred and thirty-six", "three hundred and thirty-seven", "three hundred and thirty-eight", "three hundred and thirty-nine", "three hundred and forty ", "three hundred and forty-one", "three hundred and forty-two", "three hundred and forty-three", "three hundred and forty-four", "three hundred and forty-five", "three hundred and forty-six", "three hundred and forty-seven", "three hundred and forty-eight", "three hundred and forty-nine", "three hundred and fifty ", "three hundred and fifty-one", "three hundred and fifty-two", "three hundred and fifty-three", "three hundred and fifty-four", "three hundred and fifty-five", "three hundred and fifty-six", "three hundred and fifty-seven", "three hundred and fifty-eight", "three hundred and fifty-nine", "three hundred and sixty ", "three hundred and sixty-one", "three hundred and sixty-two", "three hundred and sixty-three", "three hundred and sixty-four", "three hundred and sixty-five", "three hundred and sixty-six", "three hundred and sixty-seven", "three hundred and sixty-eight", "three hundred and sixty-nine", "three hundred and seventy ", "three hundred and seventy-one", "three hundred and seventy-two", "three hundred and seventy-three", "three hundred and seventy-four", "three hundred and seventy-five", "three hundred and seventy-six", "three hundred and seventy-seven", "three hundred and seventy-eight", "three hundred and seventy-nine", "three hundred and eighty ", "three hundred and eighty-one", "three hundred and eighty-two", "three hundred and eighty-three", "three hundred and eighty-four", "three hundred and eighty-five" Code allnumbers = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty-one ", "twenty-two ", "twenty-three ", "twenty-four ", "twenty-five ", "twenty-six ", "twenty-seven ", "twenty-eight ", "twenty-nine ", "thirty", "thirty-one ", "thirty-two ", "thirty-three ", "thirty-four ", "thirty-five ", "thirty-six ", "thirty-seven ", "thirty-eight ", "thirty-nine ", "forty", "forty-one ", "forty-two ", "forty-three ", "forty-four ", "forty-five ", "forty-six ", "forty-seven ", "forty-eight ", "forty-nine ", "fifty", "fifty-one ", "fifty-two ", "fifty-three ", "fifty-four ", "fifty-five ", "fifty-six ", "fifty-seven ", "fifty-eight ", "fifty-nine ", "sixty", "sixty-one ", "sixty-two ", "sixty-three ", "sixty-four ", "sixty-five ", "sixty-six ", "sixty-seven ", "sixty-eight ", "sixty-nine ", "seventy", "seventy-one ", "seventy-two ", "seventy-three ", "seventy-four ", "seventy-five ", "seventy-six ", "seventy-seven ", "seventy-eight ", "seventy-nine ", "eighty", "eighty-one ", "eighty-two ", "eighty-three ", "eighty-four ", "eighty-five ", "eighty-six ", "eighty-seven ", "eighty-eight ", "eighty-nine ", "ninety", "ninety-one ", "ninety-two ", "ninety-three ", "ninety-four ", "ninety-five ", "ninety-six ", "ninety-seven ", "ninety-eight ", "ninety-nine ", "one hundred", "one hundred and one ", "one hundred and two ", "one hundred and three ", "one hundred and four ", "one hundred and five ", "one hundred and six ", "one hundred and seven ", "one hundred and eight ", "one hundred and nine ", "one hundred and ten ", "one hundred and eleven ", "one hundred and twelve ", "one hundred and thirteen ", "one hundred and fourteen ", "one hundred and fifteen ", "one hundred and sixteen ", "one hundred and seventeen ", "one hundred and eighteen ", "one hundred and nineteen ", "one hundred and twenty ", "one hundred and twenty-one", "one hundred and twenty-two", "one hundred and twenty-three", "one hundred and twenty-four", "one hundred and twenty-five", "one hundred and twenty-six", "one hundred and twenty-seven", "one hundred and twenty-eight", "one hundred and twenty-nine", "one hundred and thirty ", "one hundred and thirty-one", "one hundred and thirty-two", "one hundred and thirty-three", "one hundred and thirty-four", "one hundred and thirty-five", "one hundred and thirty-six", "one hundred and thirty-seven", "one hundred and thirty-eight", "one hundred and thirty-nine", "one hundred and forty ", "one hundred and forty-one", "one hundred and forty-two", "one hundred and forty-three", "one hundred and forty-four", "one hundred and forty-five", "one hundred and forty-six", "one hundred and forty-seven", "one hundred and forty-eight", "one hundred and forty-nine", "one hundred and fifty ", "one hundred and fifty-one", "one hundred and fifty-two", "one hundred and fifty-three", "one hundred and fifty-four", "one hundred and fifty-five", "one hundred and fifty-six", "one hundred and fifty-seven", "one hundred and fifty-eight", "one hundred and fifty-nine", "one hundred and sixty ", "one hundred and sixty-one", "one hundred and sixty-two", "one hundred and sixty-three", "one hundred and sixty-four", "one hundred and sixty-five", "one hundred and sixty-six", "one hundred and sixty-seven", "one hundred and sixty-eight", "one hundred and sixty-nine", "one hundred and seventy ", "one hundred and seventy-one", "one hundred and seventy-two", "one hundred and seventy-three", "one hundred and seventy-four", "one hundred and seventy-five", "one hundred and seventy-six", "one hundred and seventy-seven", "one hundred and seventy-eight", "one hundred and seventy-nine", "one hundred and eighty ", "one hundred and eighty-one", "one hundred and eighty-two", "one hundred and eighty-three", "one hundred and eighty-four", "one hundred and eighty-five", "one hundred and eighty-six", "one hundred and eighty-seven", "one hundred and eighty-eight", "one hundred and eighty-nine", "one hundred and ninety ", "one hundred and ninety-one", "one hundred and ninety-two", "one hundred and ninety-three", "one hundred and ninety-four", "one hundred and ninety-five", "one hundred and ninety-six", "one hundred and ninety-seven", "one hundred and ninety-eight", "one hundred and ninety-nine", "two hundred", "two hundred and one ", "two hundred and two ", "two hundred and three ", "two hundred and four ", "two hundred and five ", "two hundred and six ", "two hundred and seven ", "two hundred and eight ", "two hundred and nine ", "two hundred and ten ", "two hundred and eleven ", "two hundred and twelve ", "two hundred and thirteen ", "two hundred and fourteen ", "two hundred and fifteen ", "two hundred and sixteen ", "two hundred and seventeen ", "two hundred and eighteen ", "two hundred and nineteen ", "two hundred and twenty ", "two hundred and twenty-one", "two hundred and twenty-two", "two hundred and twenty-three", "two hundred and twenty-four", "two hundred and twenty-five", "two hundred and twenty-six", "two hundred and twenty-seven", "two hundred and twenty-eight", "two hundred and twenty-nine", "two hundred and thirty ", "two hundred and thirty-one", "two hundred and thirty-two", "two hundred and thirty-three", "two hundred and thirty-four", "two hundred and thirty-five", "two hundred and thirty-six", "two hundred and thirty-seven", "two hundred and thirty-eight", "two hundred and thirty-nine", "two hundred and forty ", "two hundred and forty-one", "two hundred and forty-two", "two hundred and forty-three", "two hundred and forty-four", "two hundred and forty-five", "two hundred and forty-six", "two hundred and forty-seven", "two hundred and forty-eight", "two hundred and forty-nine", "two hundred and fifty ", "two hundred and fifty-one", "two hundred and fifty-two", "two hundred and fifty-three", "two hundred and fifty-four", "two hundred and fifty-five", "two hundred and fifty-six", "two hundred and fifty-seven", "two hundred and fifty-eight", "two hundred and fifty-nine", "two hundred and sixty ", "two hundred and sixty-one", "two hundred and sixty-two", "two hundred and sixty-three", "two hundred and sixty-four", "two hundred and sixty-five", "two hundred and sixty-six", "two hundred and sixty-seven", "two hundred and sixty-eight", "two hundred and sixty-nine", "two hundred and seventy ", "two hundred and seventy-one", "two hundred and seventy-two", "two hundred and seventy-three", "two hundred and seventy-four", "two hundred and seventy-five", "two hundred and seventy-six", "two hundred and seventy-seven", "two hundred and seventy-eight", "two hundred and seventy-nine", "two hundred and eighty ", "two hundred and eighty-one", "two hundred and eighty-two", "two hundred and eighty-three", "two hundred and eighty-four", "two hundred and eighty-five", "two hundred and eighty-six", "two hundred and eighty-seven", "two hundred and eighty-eight", "two hundred and eighty-nine", "two hundred and ninety ", "two hundred and ninety-one", "two hundred and ninety-two", "two hundred and ninety-three", "two hundred and ninety-four", "two hundred and ninety-five", "two hundred and ninety-six", "two hundred and ninety-seven", "two hundred and ninety-eight", "two hundred and ninety-nine", "three hundred", "three hundred and one ", "three hundred and two ", "three hundred and three ", "three hundred and four ", "three hundred and five ", "three hundred and six ", "three hundred and seven ", "three hundred and eight ", "three hundred and nine ", "three hundred and ten ", "three hundred and eleven ", "three hundred and twelve ", "three hundred and thirteen ", "three hundred and fourteen ", "three hundred and fifteen ", "three hundred and sixteen ", "three hundred and seventeen ", "three hundred and eighteen ", "three hundred and nineteen ", "three hundred and twenty ", "three hundred and twenty-one", "three hundred and twenty-two", "three hundred and twenty-three", "three hundred and twenty-four", "three hundred and twenty-five", "three hundred and twenty-six", "three hundred and twenty-seven", "three hundred and twenty-eight", "three hundred and twenty-nine", "three hundred and thirty ", "three hundred and thirty-one", "three hundred and thirty-two", "three hundred and thirty-three", "three hundred and thirty-four", "three hundred and thirty-five", "three hundred and thirty-six", "three hundred and thirty-seven", "three hundred and thirty-eight", "three hundred and thirty-nine", "three hundred and forty ", "three hundred and forty-one", "three hundred and forty-two", "three hundred and forty-three", "three hundred and forty-four", "three hundred and forty-five", "three hundred and forty-six", "three hundred and forty-seven", "three hundred and forty-eight", "three hundred and forty-nine", "three hundred and fifty ", "three hundred and fifty-one", "three hundred and fifty-two", "three hundred and fifty-three", "three hundred and fifty-four", "three hundred and fifty-five", "three hundred and fifty-six", "three hundred and fifty-seven", "three hundred and fifty-eight", "three hundred and fifty-nine", "three hundred and sixty ", "three hundred and sixty-one", "three hundred and sixty-two", "three hundred and sixty-three", "three hundred and sixty-four", "three hundred and sixty-five", "three hundred and sixty-six", "three hundred and sixty-seven", "three hundred and sixty-eight", "three hundred and sixty-nine", "three hundred and seventy ", "three hundred and seventy-one", "three hundred and seventy-two", "three hundred and seventy-three", "three hundred and seventy-four", "three hundred and seventy-five", "three hundred and seventy-six", "three hundred and seventy-seven", "three hundred and seventy-eight", "three hundred and seventy-nine", "three hundred and eighty ", "three hundred and eighty-one", "three hundred and eighty-two", "three hundred and eighty-three", "three hundred and eighty-four", "three hundred and eighty-five"
В яндекс лицее учишься?) The post was merged to previous Feb 21, 2020 Пиздец.... Тебе делать нечего?)
The post was merged to previous Feb 21, 2020 ахахаххахахахах, пойду залью The post was merged to previous Feb 21, 2020 а ты тоже там что ли учишься?
@hangmanEZ, тип каждый почти туда поступил может закончить на такой диплом на тройку, каждый второй на четверку, а вот на 5 диплом получить эт оч хард: первый плюс получения любого диплома это плюс при поступлении в университет особенно если кафедра от яндекса, чем лучше диплом еств тем лучше, при поступление на работу тоже небольшой, плюс во время обучения тебя также показывают разным компания, как в будущем на стажировку и работу, да еще и за самый хард диплом бесплатная поездка в офис яндекс на неделю в москву, а кр сложно решать ищу чела с которым я могу сотрудничать по поводу кр т.к. с них очень много баллов
А вообще, эту задачу можно решить в 10 строк(со сторонним модулем), но задачи со сторонниками не принимаются
нет The post was merged to previous Feb 21, 2020 The post was merged to previous Feb 21, 2020 я видел все, как бэ там все так The post was merged to previous Feb 21, 2020 51 с копейками The post was merged to previous Feb 21, 2020 а у тя какой рейтинг?
Если вам нужны готовые ответы, а не мозг напрягать, вы хоть гугл юзайте изредка :peka: (вторая ссылка в выдаче) https://i.imgur.com/Wr4lDar.png без принта в конце