Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Commit

Permalink
Removed reference to the reverse method in ipynb file
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienIrving committed Jun 4, 2014
1 parent aa0b8e8 commit a35979e
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions novice/python/03-loop.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,7 @@
" It also has a function called `pow` that calculates the same value.\n",
" Write a function called `expo` that uses a loop to calculate the same result.\n",
"\n",
"1. Python's strings have methods, just like NumPy's arrays.\n",
" One of these is called `reverse`:\n",
" \n",
" ~~~python\n",
" print 'Newton'.reverse()\n",
" notweN\n",
" ~~~\n",
" \n",
" Write a function called `rev` that does the same thing:\n",
"1. Write a function called `rev` that reverses the order of a Python string:\n",
" \n",
" ~~~python\n",
" print rev('Newton')\n",
Expand Down Expand Up @@ -914,4 +906,4 @@
"metadata": {}
}
]
}
}

1 comment on commit a35979e

@twitwi
Copy link
Contributor

@twitwi twitwi commented on a35979e Jun 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, this fixes a problem we encountered in Pisa with @apawlik.
There is actually no "reverse" method on python strings (only on python arrays, and it works in place).
There are different ways of doing it (without explicit loops), including:
http://stackoverflow.com/questions/931092/reverse-a-string-in-python

Please sign in to comment.