Skip to content

Commit

Permalink
switch to f-strings
Browse files Browse the repository at this point in the history
Some cells were still using str.format. A bunch of the internal
python files also use them, but I care less about that.
  • Loading branch information
rlabbe committed May 15, 2022
1 parent 2258eac commit cd962f3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 52 deletions.
17 changes: 8 additions & 9 deletions 02-Discrete-Bayes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2709d4897c90432eabebbcf3aa60113c",
"model_id": "c65bc79da49448efb42e0bfd882986e4",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -758,7 +758,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "29c7da8c293a43ddb6e34bd840e9971e",
"model_id": "67b1c6758fff4724b590d76d758d0de5",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1250,7 +1250,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f47a87a1ec27474ea864c92a52ce4ac9",
"model_id": "30b640471e4c4f91a079e8f32994f7f3",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1303,7 +1303,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "15dde650d59e4ffe88e2163d1220860f",
"model_id": "32ba45c576874b9d965aa34b6cbb2002",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1527,9 +1527,8 @@
" print()\n",
" print('final position is', robot.pos)\n",
" index = np.argmax(posterior)\n",
" print('''Estimated position is {} with '''\n",
" '''confidence {:.4f}%:'''.format(\n",
" index, posterior[index]*100))"
" conf = posterior[index]*100\n",
" print(f'Estimated position is {index} with confidence {conf:.4f}')"
]
},
{
Expand Down Expand Up @@ -1558,7 +1557,7 @@
" estimated position is 6 with confidence 100.0000%:\n",
"\n",
"final position is 6\n",
"Estimated position is 6 with confidence 100.0000%:\n"
"Estimated position is 6 with confidence 100.0000\n"
]
},
{
Expand Down Expand Up @@ -1607,7 +1606,7 @@
" estimated position is 8 with confidence 49.3174%:\n",
"\n",
"final position is 7\n",
"Estimated position is 8 with confidence 49.3174%:\n"
"Estimated position is 8 with confidence 49.3174\n"
]
},
{
Expand Down
107 changes: 64 additions & 43 deletions 04-One-Dimensional-Kalman-Filters.ipynb

Large diffs are not rendered by default.

0 comments on commit cd962f3

Please sign in to comment.