John Carmona wrote: > Thanks Kent for the reply, I am actually having trouble to find the > solution of the following exercise: > > ## Write a for loop that prints the ASCII code of each character in a > string name S.## > > I am ok with the for loop, put I don't know how get to print the ASCII > code of each character with a string (I also know how to use the String).
You need the ord() function and maybe hex() also: >>> ord('s') 115 >>> hex(ord('s')) '0x73' Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor