Skip to content

Instantly share code, notes, and snippets.

View junetech's full-sized avatar

Juntaek HONG junetech

View GitHub Profile
@junetech
junetech / sum_max_min_combo_gen.py
Created December 4, 2019 13:50
Python yield example: integer combination generator
from typing import List, Any, Generator
def minmaxpartition(_sum: int, _count: int, _min: int, _max: int
) -> Generator[List[Any], None, None]:
if _min > _max:
yield []
return
if _sum < _count * _min:
yield []
@junetech
junetech / error_test.py
Created December 4, 2019 04:01
Python error raising & args passing
for j in range(2):
try:
for i in range(10):
print(i)
if i == 3:
raise StopIteration
except:
print("raised successfully")
continue