Skip to content

Instantly share code, notes, and snippets.

@hannal
hannal / fruits.html
Last active June 26, 2017 08:58
Django Template이 키나 속성에 대해 조용히 넘겨주지 않고 VariableDoesNotExist 내는 경우.
{{ apple|default:lemon.dictattr.color }} {# VariableDoesNotExist exception 발생 #}
<hr />
{% with lemon.dictattr.color as colour %}
{{ apple|default:colour }} {# 문제 없음 #}
{% endwith %}
from itertools import combinations
from math import factorial
def count_combinations(n: int, r: int):
return int(factorial(n) / (factorial(r) * factorial(n-r)))
team_count = 4
# 0 1 2 3 4 5 6 7 8 9 10 11