Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

python code

I’m hoping you can help me with this python code. I almost have it correct, but i keep getting an error at the end. below is the problem along with my current code. Please see if you can adjust it to make it cooperate. Thank you!!!6.6 Warm up: Parsing strings (Python 3)

(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. (2 pts) 

Ex:

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

my code:

while True:

  name=input(‘Enter input string: ‘)

  print(“n”.rstrip(“n”))

  if(name != ‘q’):      

    name=name.replace(‘ ‘, ”)

    if ‘,’ in name:

      name=name.split(‘,’)

      print(‘First word: ‘.strip(),name[0])

      print(‘Second word: ‘.strip(),name[1])

      print(“n”.rstrip(“n”))

      print()

    else:

      ‘,’ not in name

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

while False:

  print()

Top Answer

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"