top of page
ToucanSway


PYTHON CODING
import cv2 import numpy as np img = np.zeros((100, 200, 3), dtype=np.uint8) print(img.shape) [Running] python3 -u...

waclaw_koscielniak
Aug 191 min read
Â
Â
Â


PYTHON CODING
def append_item(item, container=[]): container.append(item) return container print(append_item(1), append_item(2)) [Running] python3 -u...

waclaw_koscielniak
Aug 181 min read
Â
Â
Â


PYTHON CODING
import pandas as pd s = pd.Series([5, 8, 12, 18, 22]) s[s < 10] *= 2 print(s.sum()) [Running] python3 -u "/Users/name/test/test95.py" 78...

waclaw_koscielniak
Aug 151 min read
Â
Â
Â


PYTHON CODING
import numpy as np arr = np.array([3, 15, 8, 22, 7]) mask = arr < 10 arr[mask] = 0 print(np.sum(arr)) [Running] python3 -u...

waclaw_koscielniak
Aug 81 min read
Â
Â
Â


PYTHON CODING
def make_funcs(): return [lambda x: i * x for i in range(3)] funcs = make_funcs() results = [f(2) for f in funcs] print(results)...

waclaw_koscielniak
Aug 41 min read
Â
Â
Â


PYTHON CODING
from collections import Counter def letter_counts(word): c = Counter(word) for k, v in c.items(): yield k, v...

waclaw_koscielniak
Jul 311 min read
Â
Â
Â


PYTHON QUIZ
def func(x, y): return x if y > 0 else y result = func(5, 0) + func(0, -5) print(result) [Running] python3 -u...

waclaw_koscielniak
Jul 261 min read
Â
Â
Â


PYTHON CODING
def flatten(lst): for item in lst: if isinstance(item, list): yield from flatten(item) else: yield item print(list(flatten([1,...

waclaw_koscielniak
Jul 231 min read
Â
Â
Â


PYTHON CODING
def track_yields(): for i in range(3): print(f"Yielding {i}") yield i print("Done") for val in track_yields(): pass [Running]...

waclaw_koscielniak
Jul 211 min read
Â
Â
Â


PYTHON QUIZ
string ='abcd' for s in range(len(string)): print(s, end =" ") [Running] python3 -u "/Users/name/test/test29.py" 0 1 2 3 [Done] exited...

waclaw_koscielniak
Jul 191 min read
Â
Â
Â


PYTHON CODING
def chooser(val): if val == "a": yield from [1, 2] else: yield from [3, 4] print(list(chooser("b"))) [Running] python3 -u...

waclaw_koscielniak
Jul 171 min read
Â
Â
Â


PYTHON CODING
def early_exit(): for i in range(10): if i > 3: return yield i print(list(early_exit())) [Running] python3 -u...

waclaw_koscielniak
Jul 161 min read
Â
Â
Â


PYTHON QUIZ
check1 = ['Learn', 'Quiz', 'Practice', 'Contribute'] check2 = check1 check3 = check1[:] check2[0] = 'Code' check3[1] = 'Mcq' count = 0...

waclaw_koscielniak
Jul 141 min read
Â
Â
Â


PYTHON CODING
def values(): for i in range(10): yield i filtr = filter(lambda x: x % 2 == 0, values()) print(list(filtr)) [Running] python3 -u...

waclaw_koscielniak
Jul 131 min read
Â
Â
Â


PYTHON CODING
a = True b = False c = False if a or b and c: print("Correct") else: print("Incorrect") [Running] python3 -u...

waclaw_koscielniak
Jul 101 min read
Â
Â
Â


PYTHON CODING
def squares(): for i in range(1, 4): yield i*i s = squares() print(list(s)) [Running] python3 -u "/Users/name/test/test61.py" [1, 4,...

waclaw_koscielniak
Jul 101 min read
Â
Â
Â


PYTHON QUIZ
def func(x = 1, y = 2): x = x + y y += 1 print(x, y) func(y = 2, x = 1) [Running] python3 -u "/Users/name/test/test46.py" 3 3 [Done]...

waclaw_koscielniak
Jun 281 min read
Â
Â
Â


PYTHON CODING
def factory(n): return lambda x: x ** n square = factory(2) cube = factory(3) print(square(3), cube(2)) [Running] python3 -u...

waclaw_koscielniak
Jun 231 min read
Â
Â
Â


PYTHON QUIZ
x, y = 2, 10 x *= y * x + 1 print(x) [Running] python3 -u "/Users/name/test/test34.py" 42 [Done] exited with code=0 in 0.047 seconds...

waclaw_koscielniak
Jun 201 min read
Â
Â
Â


PYTHON QUIZ
def func(List, length): print(List[length-1], end="") func(List, length-1) func([4, 3, 2, 1], 4) [Running] python3 -u...

waclaw_koscielniak
Jun 191 min read
Â
Â
Â
bottom of page