Skip to content

Type Error in the First Coin Flipping Algorithm in Chapter 1 #577

@lorenzo8612

Description

@lorenzo8612

In Chapter 1 (Ch1_Introduction_PyMC2.ipynb) there's a type error in the first coin flipping algorithm (Example: Mandatory coin-flip example) at line:
sx = plt.subplot(len(n_trials) / 2, 2, k + 1) inside the for-cycle.
The operation len(n_trials) / 2 gives back a float and not an integer (at least in the current version of Colab).

It can be fixed by adding int():
sx = plt.subplot(int(len(n_trials) / 2), 2, k + 1)

Edit:
Or more simply with len(n_trials) // 2 as Lucian Sasu suggested:
sx = plt.subplot(len(n_trials) // 2, 2, k + 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions