Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
data[len(data) - 1] 等效于 data[-1]。
  • Loading branch information
yongchengzhao authored Mar 15, 2019
1 parent d5b287f commit 83c50c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Part.1.A.better.teachyourself.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
" delimiter=',',\n",
" names=['x', 'y'])\n",
"da1960 = data[0][1]\n",
"da2016 = data[len(data)-1][1]\n",
"da2016 = data[-1][1]\n",
"increase = (da2016 - da1960)/da1960\n",
"note = 'from {:.2f} in 1960 to {:.2f} in 2016, increased {:.2%}'\\\n",
" .format(da1960, da2016, increase)\n",
Expand Down

0 comments on commit 83c50c4

Please sign in to comment.