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
WHAT DOES THE SCRATCH CODE BELOW DO?
Vinil7 [7]
I think it’s b vertically
7 0
3 years ago
Why electronic file organization is a key skill for today's workplace ​
Rufina [12.5K]
(I am not sure what you are asking since question is not specific enough),
I am assuming you are asking why organizing a file on a computer is a key skill-

It is because today’s workplace should have as much organization as possible for a steady workplace and work environment, making needed files easy to access.
3 0
3 years ago
Design a Visual Logic flowchart for a program that prompts the user to enter ten numbers one at a time. After the user has enter
swat32
N = 0 

<span>1 read x </span>

<span>n = n + 1 </span>

<span>print x </span>

<span>If n > 1, go down to 2 </span>

<span>small = x </span>
<span>large = x </span>

<span>2 If x</= small, then small = x </span>
<span>If x>/= large, then large = x </span>

<span>If n < 12 , go back up to 1 </span>

<span>Print small </span>
<span>Print large </span>
<span>end</span>
8 0
3 years ago
What are some of the other operations that might be implemented for a stack?
melomori [17]

Answer:

push, pop, top, clear

Explanation:

push: add a new value

pop: remove and return top value

top: return top value without removing

clear: remove all values

6 0
3 years ago
Gabe just won the lottery after ten years of consistently buying a ticket every Friday. Based on his initial reaction of feeling
ludmilkaskok [199]
The answer is D. cortisol level would most likely decrease.                                                                                                                                                                             

5 0
4 years ago
Read 2 more answers
Other questions:
  • A __________ network is good for connecting computer clusters.
    13·2 answers
  • Question # 6
    13·1 answer
  • Which term represents a computational instruction stored in computer memory?
    13·2 answers
  • A ____ appearing in the main text of a document indicates a footnote or endnote.
    15·1 answer
  • The appropriate length for an e-mail is about half the amount of text that will fit on an 8 1/2' by 11' page.
    11·2 answers
  • What are the chief contributions of philosophy to artificial intelligence?
    13·1 answer
  • Which is a good guideline to follow when looking for research material on the Internet?
    10·2 answers
  • What feature adjusts the top and bottom margins so that the text is centered vertically on the printed page?
    14·1 answer
  • ***URGENT***
    8·1 answer
  • Software piracy can be described as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!