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
A) What is the maximum value that can be represented as an unsigned n-bit binary integer?
My name is Ann [436]

Answer:

The maximum value that are represented as unsigned n -bit binary integer is 2^n-1. The unsigned binary integer refers to the fixed point of the system that does not contain any fractional digits.

The unsigned binary integer contain module system with the power 2. The number of student table in the class is the best example of the unsigned integer. The numbers can be represented by using the binary notation and bits in the computer system.

5 0
3 years ago
the control programs managing computer hardware and software use the ______ function to control and prioritize tasks performed b
Ira Lisetskai [31]

application management


7 0
2 years ago
Page 1. I who invented computer?​
svetoff [14.1K]
Charles baggage (picture for more info)

4 0
2 years ago
What web 2.0 features allows users to subscribe to a data plan that charges for the amount of time spent on the internet?
galina1969 [7]

Answer:

The answer to this question is given in the explanation section. The correct option is long tail

Explanation:

a.Folksonomy

Folksonomy is a way of organizing data and digital content. With Web 2.0, users can collaboratively manage and tag photos, journals and other media. As more users do this, creates a system of classification for the media and information.  so this option is not correct

b. long tail (correct option)

Some sites are able to offer services as well in which users can subscribe monthly or pay a fee every so often. An example of this would be Netflix.

c.user participation

All users have the free will to contribute to the site which makes many Web 2.0 pages public. With sites such as Wikipedia, anyone is open to the editing of articles. Information is provided two-way instead of solely from the site owner.

d.application

Web 2.0 applications that allow anyone to create and share online information or material they have created. As you know that there are number of different types of web 2.0 applications including wikis, blogs, social networking, folksonomies, podcasting & content hosting services.

3 0
2 years ago
When data are entered into a form and saved, they are placed in the underlying database as knowledge?
luda_lava [24]
The answer would be and is true.
7 0
2 years ago
Other questions:
  • Suppose you are currently in the /home/hnewman/os/fall/2013 directory and would like to navigate to /home/hnewman/discreteStruct
    9·1 answer
  • Match each task with the features necessary to complete the task
    10·1 answer
  • Write a program that prints the following text: In C, lowercase letters are significant. main() is where program execution begin
    14·1 answer
  • Select the antonym for given word freedom
    7·2 answers
  • The instructions in the language of alice are contained on ____ which you can drag and drop into place to ____ new programs
    8·1 answer
  • What is the IEEE 802 standards name for a wireless network that is limited to one person's workspace?
    14·1 answer
  • Write a program that reads a file called 'test.txt' and prints out the contents on the screen after removing all spaces and newl
    7·1 answer
  • Who wants to join my Among us?<br><br><br>Code: EDQKNF <br><br><br>&lt;3333​
    9·2 answers
  • Discuss the ways you can perform to prevent your computer/device and its data/contents from being stolen. Define two-facto authe
    7·1 answer
  • Which is the first calculating device invented?​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!