Skip to content

Commit 265f876

Browse files
committed
Newsletter #40: replace ipython with REPL syntax
1 parent f635565 commit 265f876

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

_posts/en/newsletters/2019-04-02-newsletter.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Python reference library so you can see how little work this is. We
9292
start by importing the library:
9393

9494
```python3
95-
import segwit_addr
95+
>>> import segwit_addr
9696
```
9797

9898
Bech32 addresses have a Human-Readable Part (HRP) that indicates what
@@ -104,17 +104,17 @@ testnet address is tb1q3w[...]g7a. We'll set the Bitcoin mainnet HRP of
104104
are for the network we expect.
105105

106106
```python3
107-
HRP='bc'
107+
>>> HRP='bc'
108108
```
109109

110110
Finally, we have a few addresses we want to check---one that should work
111111
and two that should fail. (See [BIP173][] for a complete set of
112112
[reference test vectors][bip173 test vectors].)
113113

114114
```python3
115-
good_address='bc1qd6h6vp99qwstk3z668md42q0zc44vpwkk824zh'
116-
typo_address='bc1qd6h6vp99qwstk3z669md42q0zc44vpwkk824zh'
117-
wrong_network_address='tb1q3wrc5yq9c300jxlfeg7ae76tk9gsx044ucyg7a'
115+
>>> good_address='bc1qd6h6vp99qwstk3z668md42q0zc44vpwkk824zh'
116+
>>> typo_address='bc1qd6h6vp99qwstk3z669md42q0zc44vpwkk824zh'
117+
>>> wrong_network_address='tb1q3wrc5yq9c300jxlfeg7ae76tk9gsx044ucyg7a'
118118
```
119119

120120
Now we can simply attempt to decode each of these addresses
@@ -124,11 +124,11 @@ Now we can simply attempt to decode each of these addresses
124124
(0, [110, 175, 166, 4, 165, 3, 160, 187, 68, 90, 209,
125125
246, 218, 168, 15, 22, 43, 86, 5, 214])
126126

127-
In [16]: segwit_addr.decode(HRP, typo_address)
128-
Out[16]: (None, None)
127+
>>> segwit_addr.decode(HRP, typo_address)
128+
(None, None)
129129

130-
In [17]: segwit_addr.decode(HRP, wrong_network_address)
131-
Out[17]: (None, None)
130+
>>> segwit_addr.decode(HRP, wrong_network_address)
131+
(None, None)
132132
```
133133

134134
If we get back a None for the first value (the witness version), the

0 commit comments

Comments
 (0)