switch to f-strings

Some cells were still using str.format. A bunch of the internal
python files also use them, but I care less about that.
This commit is contained in:
Roger Labbe 2022-05-15 14:13:46 -07:00
parent 2258eacd92
commit cd962f3091
2 changed files with 72 additions and 52 deletions

View File

@ -581,7 +581,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2709d4897c90432eabebbcf3aa60113c",
"model_id": "c65bc79da49448efb42e0bfd882986e4",
"version_major": 2,
"version_minor": 0
},
@ -758,7 +758,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "29c7da8c293a43ddb6e34bd840e9971e",
"model_id": "67b1c6758fff4724b590d76d758d0de5",
"version_major": 2,
"version_minor": 0
},
@ -1250,7 +1250,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f47a87a1ec27474ea864c92a52ce4ac9",
"model_id": "30b640471e4c4f91a079e8f32994f7f3",
"version_major": 2,
"version_minor": 0
},
@ -1303,7 +1303,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "15dde650d59e4ffe88e2163d1220860f",
"model_id": "32ba45c576874b9d965aa34b6cbb2002",
"version_major": 2,
"version_minor": 0
},
@ -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}')"
]
},
{
@ -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"
]
},
{
@ -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"
]
},
{

File diff suppressed because one or more lines are too long