12/19


#1

33%20PM

when I loop through the characters (char), am i still printing them out as a whole string sentence? Or is each letter a string concatenated together?


#3
phrase = "A bird in the hand..."

for char in phrase:
  if char == 'A' or char=='a':
    print 'X',
  else:
    print char,

  


print

#4

A \n character is written at the end,
unless the print statement ends with a comma.

so you are printing the individual characters/letters of string, but because your print ends with , python doesn’t add a newline character (\n) at the end of string


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.