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’)
Need assignment help for this question?
If you need assistance with writing your essay, we are ready to help you!
OUR PROCESS
Order
Payment
Writing
Delivery
Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality
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.’)
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