masterPiece93 / PythonEssentials

0 stars 0 forks source link

IceCream python library usage #4

Open masterPiece93 opened 10 months ago

masterPiece93 commented 10 months ago
masterPiece93 commented 10 months ago
from icecream import ic

# Ex1 :
# -------------------------------------------------
n_numbers = lambda n: [v for v in range(n)]

ic(n_numbers(10))
# -------------------------------------------------

# Ex2 :
# -------------------------------------------------
def complex_fn(a: dict, b: list, c:str = None):
    a[c]=b
    return a

ic(complex_fn(*ic({},[1,2,3],'a')))
# -------------------------------------------------

# Ex3 :
# -------------------------------------------------
d = dict(
    a={
        "x":[1,2,3],
        "y":dict(
            p="nice."
        )
    },
)
ic(d)
ic(d["a"]["y"]["p"])
# -------------------------------------------------