ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 8 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 Apr 2017 My Price 9.00

a string that contains two strings separated by a comma

I'm having trouble getting started with this (Python)

 

Prompt the user for a string that contains two strings separated by a comma. (1 pt)

  • Examples of strings that can be accepted:Jill, Allen
  • Jill , Allen
  • Jill,Allen 

Ex:

Enter input string: Jill, Allen

 

(2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. (2 pts) 

 

Ex:

Enter input string: Jill Allen
Error: No comma in string.
Enter input string: Jill, Allen

 

(3) Using string splitting, extract the two words from the input string and then remove any spaces. Output the two words. (2 pts) 

 

Ex:

Enter input string: Jill, Allen
First word: Jill
Second word: Allen

 

(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

Answers

(11)
Status NEW Posted 26 Apr 2017 04:04 AM My Price 9.00

Ans-----------wer-----------: -----------  ----------- wh-----------ile-----------(1)-----------: ----------- Â----------- s -----------= r-----------aw_-----------inp-----------ut(-----------"En-----------ter----------- in-----------put----------- st-----------rin-----------g:"-----------) ----------- Â----------- if----------- s -----------== -----------"q"----------- : -----------  ----------- Â----------- Â -----------bre-----------ak -----------  ----------- i-----------f s-----------.fi-----------nd(-----------','-----------)==------------1:----------- Â----------- Â ----------- Â----------- pr-----------int----------- "E-----------rro-----------r: -----------No -----------com-----------ma

Attachments

1501538557-Prompt.zip
Not Rated(0)