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
A(n) _______________ loop usually occurs when the programmer forgets to write code inside the loop that makes the test condition
Serggg [28]
Infinite





,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
5 0
3 years ago
What mathematical equation was created by a founder of intel?.
mestny [16]

Arithmetic Logic Unit is said to be mathematical equation was created by a founder of intel.

<h3>What was this Arithmetic Logic Unit about?</h3>

Arithmetic Logic Unit is known to be Part of the CPU that was set up to perform mathematical equations. It is known to act as a passway to and from the processor.

Gordan Moore is known to be the founder of Intel. He is the man who has helped shape the modern world and produce  the base technology root.

Learn more about Arithemetic Logic Unit from

brainly.com/question/26486053

5 0
2 years ago
Write a python application that allows a user to enter any number of student test scores until the user enters 999. If the score
Kryger [21]

Answer:

This program is as follows

<em>total = 0; count = 0</em>

<em>testscore = int(input("Score: "))</em>

<em>while testscore != 999:</em>

<em>    if testscore < 0 or testscore > 100:</em>

<em>        print("Out of range")</em>

<em>    else:</em>

<em>        total+=testscore</em>

<em>        count+=1</em>

<em>    testscore= int(input("Score: "))</em>

<em>print(count,"scores entered")</em>

<em>print("Arithmetic Average:",total/count)</em>

Explanation:

This initializes total and count to 0

total = 0; count = 0

This gets input for score

testscore = int(input("Score: "))

The following iteration stop when 999 is entered

while testscore != 999:

This prints out of range for scores outside 0 - 100

   if testscore < 0 or testscore > 100:

<em>        print("Out of range")</em>

Otherwise

   else:

The total score is calculated

       total+=testscore

The number of score is calculated

       count+=1

Get another input

   testscore = int(input("Score: "))

The number of score is printed

print(count,"scores entered")

The average of score is printed

print("Arithmetic Average:",total/count)

7 0
3 years ago
Vhat is output by the code below?<br><br> PLEASE HELP!! TIME LIMIT!!
marysya [2.9K]

Answer:

My best guess about this is C

Explanation:

6 0
3 years ago
____ is (are) the abuse of e-mail systems to send unsolicited e-mail to large numbers of people.
Volgvan
Pretty sure answer is <span>E-mail spam</span>
4 0
2 years ago
Other questions:
  • The program prompts the user to interactively enter eight batting averages, which the program stores in an array. The program sh
    9·1 answer
  • _______ are unprocessed facts that a computer feeds on.
    5·1 answer
  • Which data type stores images and audio visual clips?
    9·2 answers
  • Lewis is using a stylus with his touch screen computer in order to draw a
    8·1 answer
  • A computer supply company is located in a building with three wireless networks.
    10·1 answer
  • In your own words, describe how a network administrator can use the OSI model to isolate a network problem.
    13·1 answer
  • Give two reasons you should be aware of your computer's system components and their characteristics.
    10·1 answer
  • My feelings alwayss T-T
    14·2 answers
  • Which of the following statements about interpreting colors are true? Select 3 options.
    11·1 answer
  • What is the full form of RPM in computer ​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!