1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
stellarik [79]
3 years ago
11

) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message

and prompt again for a valid data point. If entry has no comma Output: Error: No comma in string. (1 pt) If entry has more than one comma Output: Error: Too many commas in input. (1 pt) If entry after the comma is not an integer Output: Error: Comma not followed by an integer. (2 pts)
Computers and Technology
1 answer:
emmainna [20.7K]3 years ago
4 0

Answer:

In Python:

entry = input("Sentence: ")

while True:

   if entry.count(",") == 0:

       print("Error: No comma in string")

       entry = input("Sentence: ")

   elif entry.count(",") > 1:

       print("Error: Too many comma in input")

       entry = input("Sentence: ")

   else:

       ind = entry.index(',')+1

       if entry[ind].isnumeric() == False:

           print("Comma not followed by an integer")

           entry = input("Sentence: ")

       else:

           break

print("Valid Input")

Explanation:

This prompts the user for a sentence

entry = input("Sentence: ")

The following loop is repeated until the user enters a valid entry

while True:

This is executed if the number of commas is 0

<em>    if entry.count(",") == 0:</em>

<em>        print("Error: No comma in string")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is more than 1

<em>    elif entry.count(",") > 1:</em>

<em>        print("Error: Too many comma in input")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is 1

   else:

This calculates the next index after the comma

       ind = entry.index(',')+1

This checks if the character after the comma is a number

       if entry[ind].isnumeric() == False:

If it is not a number, the print statement is executed

<em>            print("Comma not followed by an integer")</em>

<em>            entry = input("Sentence: ")</em>

If otherwise, the loop is exited

<em>        else:</em>

<em>            break</em>

This prints valid input, when the user enters a valid string

print("Valid Input")

Note that: entry = input("Sentence: ") <em>is used to get input</em>

You might be interested in
Select what's true about Search Engine Companies. Check All That Apply The information contained in a search engine database is
hammer [34]

Answer:

Option A B is the correct option for the following question.

Explanation:

Because search engine companies are the companies that create the search engines like Yahoo, Google, DuckDuckGo, etc. and search engine are the tool which contain the information about which users search on it and also contain the records of the URL in their database. URL is submitted by the owner of the website and information to the SEC.

4 0
3 years ago
When using color in a computer - generated presentation aids you should use?
Temka [501]
<span>the answer is: the same background color on all visuals and no more than two colors for words.</span>
6 0
2 years ago
Which scenario depicts an ethical workplace practice by a business owner
viva [34]

The answer is D. It's asking for the most UNETHICAL not ETHICAL, the answer before me was ETHICAL. Sharing personal data is UNETHICAL.

4 0
2 years ago
Read 2 more answers
What type of platform is SAP?
Alex787 [66]
SAP is a data and business processing platform.
7 0
3 years ago
What is Identity Theft?
olga55 [171]
A is correct! We did this in Law!

Have a merry Christmas!
5 0
3 years ago
Other questions:
  • Which software application should be used to create a sales pitch to a group of people? Database Email Presentation Word process
    9·1 answer
  • Search engines enable you to
    14·1 answer
  • If a security officer is non-commissioned officer, he can carry a baton on duty if he went through a training class
    8·1 answer
  • What Will Social Media Look Like in the Future?
    6·1 answer
  • Wrtie down some containerization technology.
    11·1 answer
  • 01110101<br> +00100100<br> 00010001
    8·1 answer
  • I need some help with this assignment. I'm having difficulty trying come up ideas to use here. Can I get any help?
    5·1 answer
  • Ethan wants to change the font in his document. He should _____.
    8·1 answer
  • You should move around and take a rest for 30 minutes every 5 minutes.<br><br>True Or False​
    9·1 answer
  • DRAW A FLOWCHART THAT WILL ASK THE USER TO ENTER AND DISPLAY THEIR PERSONAL DETAILS SUCH AS NAME AND AGE.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!