DEV Community

Durga Pokharel
Durga Pokharel

Posted on

Day 65 Of 100DaysOfCode: Implement Clumsiness

This is my 65th days of #100daysofcode and #python learning. Today learned more about data visualization from matplotlib. Completed some assignment in datacamp.

Implement Clumsiness

# Simulate random walk 250 times
all_walks = []
for i in range(10) :
    random_walk = [0]
    for x in range(100) :
        step = random_walk[-1]
        dice = np.random.randint(1,7)
        if dice <= 2:
            step = max(0, step - 1)
        elif dice <= 5:
            step = step + 1
            step = step + np.random.randint(1,7)

        # Implement clumsiness
        if ___ :
            step = 0


# Create and plot np_aw_t
np_aw_t = np.transpose(np.array(all_walks))
Enter fullscreen mode Exit fullscreen mode

Day 65 Of #100DaysOfCode and #Python3
Worked on data visualization using matplotlib.#WomenInTechnology ,#100DaysOfCode ,#CodeNewbie #DEVCommunity

— Durga Pokharel (@mathdurga) March 3, 2021

Top comments (1)

mccurcio profile image
Matt Curcio

That's funny. I haven't thought about a "clumsy" random walker before.
If you fell down on your random walker and near the end of your walk, you
would have to jump and fall(at the same time) all the way to the beginning. lol
Quite a feat!