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
Degger [83]
3 years ago
9

including how it can be stored and what types of operations we can perform. For example, we can write a program that squares num

bers, but it wouldn’t be able to square a word.
Computers and Technology
1 answer:
ASHA 777 [7]3 years ago
6 0

Answer:

The solution code is written in Python:

  1. def square(num):
  2.    if type(num).__name__ == 'int':
  3.        sq_num = num * num
  4.        return sq_num  
  5.    else:
  6.        return "Invalid input"
  7. print(square(5))
  8. print(square("Test"))

Explanation:

To ensure only certain type of operation can be applied on a input value, we can check the data type of the input value. For example, we define a function and name it as <em>square</em> which take one input number, <em>num </em>(Line 1).

Before the <em>num</em> can be squared, it goes through a validation mechanism in by setting an if condition (Line 2) to check if the data type of the input number is an integer,<em> int.</em> If so, the<em> num </em>will only be squared otherwise it return an error message (Line 6).

We can test our function by passing value of 5 and "Test" string. We will get program output:

25

Invalid input

You might be interested in
Un automobil se desplaza a 1 458 km en direccion hacia el norte en un tiempo den 18 h. Cual es la velocidad promedio utilizada p
d1i1m1o1n [39]

Answer:

42

Explanation:

7 0
3 years ago
HAS ANYONE HEARD OF THE GAME SCHOOL DAY
Musya8 [376]

Answer:

NO BUT IT SOUNDS FUN

Explanation:

I PROBABLY HAVE NOT HEARD OF IF BC IM HOMESCHOOLED :D

3 0
3 years ago
The computer code behind password input can be modified to force people to change their password for security reasons. This is k
bazaltina [42]

Answer:

to remember the passwords you could either make a little rhyme to "help" remember it or you could be like everyone else and write it down on a piece of paper. you could also write the password over and over again to make it stick. a way to make a password different from an old one is to use completely different wording and completely different numbers.

Explanation:

3 0
3 years ago
A voltage measurement error is caused by the integration time window of a digital volt-meter. This is a _____________error.
gladu [14]

Answer: Systematic error

Explanation:

  The systematic error is the type of error which is basically caused due to the integration time of the digital volt meter in the voltage error measurement.

It is one of the type of error that occur during the measurement of the voltage due to mismatch start channel. It basically result into the difference between the fall and rise in channel and the difference in the propagation delay.

The systematic error is basically introduce by interconnect different types of cable and setting the triggering level in the system. This type of error are constant in the given measurement configuration process.

4 0
4 years ago
System where energy is used to move people is a what system
Travka [436]

Energy is not consumed by motion. And since motion is relative, that means the amount of energy is relative to reference frame.
4 0
3 years ago
Other questions:
  • What is the Multiple Source Test
    12·2 answers
  • You can upgrade a cpu by adding registers and cache memory to it. <br> a. True <br> b. False
    7·1 answer
  • This is not what I asked for​
    15·1 answer
  • Number Array Class
    5·1 answer
  • Which protocol sends a request to view or download a website or file ​
    7·1 answer
  • Nia is editing a row in an Access table. The row contains the Pencil icon on the left end of the record
    12·2 answers
  • Tina has taken the time to modify font sizes and colors in a text box and would like to duplicate those settings on other text b
    12·2 answers
  • What is keyword density?
    15·2 answers
  • Kenny is asked to submit a photo for the annual photographic competition. He decided to capture a photo with the light-painting
    15·1 answer
  • an engineer is writing a web application that requires some user input. the engineer has put a submit button on their page and n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!