DEV Community

Durga Pokharel
Durga Pokharel

Posted on

5 1

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
        else:
            step = step + np.random.randint(1,7)

        # Implement clumsiness
        if ___ :
            step = 0

        random_walk.append(step)
    all_walks.append(random_walk)

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

Day 65 Of #100DaysOfCode and #Python3
Worked on data visualization using matplotlib.#WomenInTechnology ,#100DaysOfCode ,#CodeNewbie #DEVCommunity pic.twitter.com/yogjWr5YP9

— Durga Pokharel (@mathdurga) March 3, 2021

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (1)

Collapse
 
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!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay