zybooks, parsing strings.

Ok guys, I’m having trouble with my code in zybooks, parsing strings.. I have passed 5/ 7 but don’ t know what’s wrong now.. Here’s my code:

while True:

  string1 = input(‘Enter input string: n’)

  if (string1 == ‘q’):

    break;

  if ‘,’ not in string1:

    print(‘Error: No comma in string.’)

  elif ‘ ‘ not in string1:

    print(‘Error: No comma in string.’)

  elif ‘ ‘ in string1:

    print(‘Error: No comma in string.’)

Screen Shot 2018-10-03 at 8.06.58 AM.png

  else:

    first_word, second_word = string1.split(‘,’)

    first_word, second_word = first_word.strip(), second_word.strip()

    print(‘First word:’, first_word)

    print(‘Second word:’, second_word)

    print()

    print() ATTACHMENT PREVIEW

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp