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
Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hou
lisov135 [29]

Answer:

public class Clock

// create the class

{

private int hours;

// variable declaration of  hours

private boolean isTicking;

// variable declaration of boolean

private Integer diff;

 // variable declaration of  diff

}

Explanation:

Following are the description of the above code  

  • Firstly create the class called To Create any class we use the keyword class followed by the class name.
  • In the class, we declared three variable one type integer called " hours" The second is type boolean called "isTicking" and the last one is also integer called "diff".
  • They all are three variables are private it means they are not accessible outside the class.
4 0
3 years ago
What microprocessor was the first to be processable<br> ?
vlada-n [284]
Hey there!

Here is your answer:

<u><em>The proper answer to this question is "the 4004".</em></u>

Reason:

<u><em>The 4004 was the first microprocessor that was process able. It was made by Intel The first microprocessor was designed in 1968.</em></u>

If you need anymore help feel free to ask me!

Hope this helps!

~Nonportrit
8 0
3 years ago
1)What is the hydropower resources/energy?
s344n2d4d5 [400]

Answer:

.

Explanation:

.

6 0
3 years ago
The labels on the tab buttons on the Driver tab of the Windows Device are Driver Details, Update Driver, Roll Back Driver, Unins
kifflom [539]

Answer:

Disable

Explanation:

In window devices, "Disable" is an option which is use as 'disables the selected device'. It is sub menu under Driver.

4 0
3 years ago
My home PC has IP address 192.168.1.22 and connects to the Internet through a NAT router. Assume I am downloading a web page fro
alekssr [168]

Answer and Explanation:

There are three sections to the inquiry.  

1. what occurs inside the PC or host when a bundle is produced by an application.  

2.how it goes from one host that is a source to another host that is a goal with numerous switches sitting in the middle.  

3.what goes inside goal have when it gets a parcel on the system.  

how about we examine individually  

Handling bundle at source machine:  

The application creates a bundle to be sent on the system and sends it to the layer beneath.  

The following layer is known as a vehicle layer which oversees start to finish correspondence between two machines. The convention utilized can be TCP or UDP. What is the contrast between these two conventions is another subject by and large.  

When the parcel is framed at the vehicle layer, it is sent to the system layer which includes source and goal IP in the bundle. A most significant field which is included at IP or system layer is Time To Live (TTL) which is utilized by middle switches/changes to choose if a parcel should be sent or not. (How goal IP is found?)  

After the system layer, the parcel arrives at the information connection or MAC layer, where the source and goal MAC address of machines are included. We will perceive how these fields change between each two neighbors. (How goal MAC is found?)  

The information interface layer pushes this bundle to the physical layer where it is sent as a flood of "0" and "1" on the physical medium accessible.  

Preparing a bundle at switch:  

Steering  

There are three cases which may happen when the switch investigates the directing table for goal IP  

1. On the off chance that there is a section relating to goal IP, we get the interface name the parcel ought to be sent to.  

2. On the off chance that there is no immediate passage, at that point IP is changed over into organize IP utilizing the veil and afterward checked once more. It ought to be noticed that the longest prefix match to locate the best sending interface.  

3. In the case of nothing matches, at that point the switch just advances it to the default goal designed.  

Sending  

Epitome  

Preparing parcel at the goal have  

The parcel is gotten at arrange card, physical layer, which produces a hinder to CPU and CPU peruses bundle in,  

At the information connect layer, goal MAC address is verified whether the parcel is bound to this machine, If indeed, the bundle is sent up to the system layer.  

At the IP layer, parcel approval like checksum confirmation, and so on is done and afterward gave to the applicable vehicle layer.  

Transport later at that point gives it to the fitting port with the goal that it arrives at the right application.

5 0
3 years ago
Other questions:
  • Cleo finds herself frequently searching for messages from particular senders or with specific subjects. What should she create
    5·1 answer
  • The _______ number system allows digital devices to represent virtually any number simply by using 0s and 1s.
    11·1 answer
  • Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks a
    12·1 answer
  • Give an example of an input device, an output device, a storage device, and a networking device.
    10·1 answer
  • @anthonydboss23<br><br> it’s goldielove6 <br><br> .....this is not a question everyone ignore this
    11·2 answers
  • Differentiate between trusted-source-security and antispoofing-security techniques.
    10·1 answer
  • Complete the method, print Multiples(), that takes in a positive integer n, and another positive integer, max. Print out all the
    15·1 answer
  • How to change color of object in photoshop?
    10·2 answers
  • What is the data and information with example? ​
    9·1 answer
  • Write a formula that would return a TRUE result if the sum of the first five numbers in a column of data are negative
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!