Question: This code is not working while True: names = input(Enter input string:) if names == q: break validlnput =true while , not in names: validlnput=true

This code is not working while True: names = input("Enter input string:") if names == "q": break validlnput ="true" while "," not in names: validlnput="true" print ("Error: No comma in string.") names = input("Enter input string:") # Check for q to terminate if names == "q": exit(0) #set the flag else: validlnput="false" s = names.split(",") print ("First word:",s[0].strip()) print ("Second word:",s[1].strip()) print (" ") The output should read Enter input string: Jill, Allen First word: Jill Second word: Allen Enter input string: Golden , Monkey First word: Golden Second word: Monkey Enter input string: Washington,DC First word: Washington Second word: DC Enter input string: q The code is producing the following Enter input string:First word: Jill Second word: Allen Enter input string:First word: Golden Second word: Monkey Enter input string:First word: Washington Second word: DC Enter input string:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!