Learning Python here: I am simply trying to switch characters in a string. Example: ‘A’ to ‘C’. The string just isn’t doing anything. Here is what I have so far:
import string
dummy = "beans"
for i in xrange(len(dummy)):
chr(ord(dummy[i])+5)
print(dummy)
Remember that strings are immutable, so you will need to re-assign your original string. You can try something along these lines:
This would be a more Pythonic approach: