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 do we call a subset of new media in which groups and their fans can interact directly?
ser-zykov [4K]
<span>A subset of new media in which groups and their fans can interact directly is referred to as social media.
</span>Social media is a computer-based technology that can p<span>rovide radically different social actions.Examples include: twitter, instagram, facebook.
</span>Social media is very influential so it is becoming a very important part of marketing.
5 0
3 years ago
Write the definition of a class employee base on the modular specification: . A data member for Id of type int (private). A data
djyliett [7]

Answer:

public class Employee {

   private int id;

   private String empName;

   private double salary;

   

   public void displayEmployee(){

       System.out.print("Employee ID: " + id + "\nEmployee name: " + empName + "\nSalary: " + salary);

   }

}

Explanation:

- Declare the class variables

- Write a method called <em>displayEmployee</em> to display the fields

7 0
3 years ago
But this time use 16 kib pages instead of 4 kib pages. what would be some of the advantages of having a larger page size? what a
uranmaximum [27]

Here are the advantages and disadvantages of larger paper size: 

Advantages: 

Reduces minor page faults. 

Disadvantages: 

There will be a decrease in the number of frames. 

There will be an increase number of page faults. 

<span>Waste of more space with the internal fragmentation.</span>

6 0
4 years ago
What is the function of tab?<br>​
Sholpan [36]

Answer:

The function of the tab is used to advance the cursor to the next tab key.

5 0
1 year ago
What is the purpose of an arraignment?
IgorC [24]

Answer:

At an arraignment, the court officially illuminates a litigant regarding charges contained in a prosecution or data, gives the respondent a duplicate of the charging instrument, and takes the litigant's response to those charges as a request.

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • What does delegating access give someone the permission to do on behalf of the user? Choose two answers.
    5·1 answer
  • What is a main cause of a virus on a computer
    6·1 answer
  • What are some ways to accept data typed into a cell? Check all that apply.
    15·1 answer
  • Peter has a website that promotes his local vacation rental site. He uses Google Ads to manage his advertising campaign. He’s cr
    13·1 answer
  • Amazon.com uses a customer profiling system whenever a customer visits its website. using this system, amazon can offer products
    6·1 answer
  • kieran wants to search a database quickly for information on the last time a patient came to his medical facility.The informatio
    14·2 answers
  • Bored can you talk to me
    5·2 answers
  • Speed(?)
    5·1 answer
  • WILL GIVE BRAINLIEST! 20 POINTS! PLZ HELP!
    14·2 answers
  • Write a format operation that builds a string for the float variable amount that
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!