Answer on Question#39909, Programming, Python
to read:
Lists,
Strings
#x = str(raw_input("Enter a Sentence: "))
x = "Hello World!"
print x #string line
letters = [letter for letter in x]
print letters #list of letters
#now perform manipulations on list
letters += [' ',':',')']
#change by index
letters[6] = 'w'
#find by value
newX = "" #new sentence
for i in range(len(letters)):
if letters[i] == 'o':
letters[i] = '0'
newX += letters[i]
print newX
Comments
Leave a comment