Форум сайта python.su
А есть ли сборник задач по программированию, которые будут не слишком сложные, чтобы можно было улучшать скилы в программировании!
Офлайн
Хотите получить skills?
Офлайн
Офлайн
Офлайн
мне понравилось http://www.altlinux.org/Books:PythonSchool
Офлайн
codingbat явно учит плохому. Вот, например задача:
Given a string and a non-negative int n, we'll say that the front of the string is the first 3 chars, or whatever is there if the string is less than length 3. Return n copies of the front;
front_times('Chocolate', 2) → ‘ChoCho’
front_times('Chocolate', 3) → ‘ChoChoCho’
front_times('Abc', 3) → ‘AbcAbcAbc’
Вот их решение:
def front_times(str, n):
front_len = 3
if front_len > len(str):
front_len = len(str)
front = str[:front_len]
result = ""
for i in range(n):
result = result + front
return result
Офлайн
EdИ правильно :)
Повбывав бы
def front_times(s, n):
return s[:3]*n
Отредактировано (Апрель 23, 2011 10:20:26)
Офлайн
EdНу никто ж не заставляет в их решения заглядывать :) А задачки для разминки там неплохие. Плюс прогресс и решения сохраняются.
Повбывав бы
Офлайн
VaderСпасибо за наводку, очень понравился сайт.
http://codingbat.com/
Офлайн