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]
4 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]4 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
Who needs to be involved when assembling business solutions that include hardware and software?
sveta [45]
Software engineer i would say
5 0
3 years ago
Read 2 more answers
Im sad cheer me up please
SSSSS [86.1K]

Answer:

Don't worry !! Everything will be fine

Explanation:

5 0
3 years ago
Read 2 more answers
Disadvantages of using social network site GOAL SETTTING?
andriy [413]

Answer:

addiction, mental illness, misleading information, scams, cyberbullying

Explanation:

4 0
2 years ago
16. Which of the following is true about function return statements? A) A function can hold multiple return statements, but only
monitta

Answer:

A) A function can hold multiple return statements, but only one return statement executes in one function call

Explanation:

This is because each function can only return one value, whether it be an integer, String, or other object.

However, you can have a series of if-else statements, or case statements, to return a different value depending on information (within parameters, or variables.

Excellent. So, you can have multiple return statements, but the function will only end up executing one of these return statements and return a single value.

Hope this helps!

7 0
3 years ago
When you are configuring data deduplication, you must choose a usage type for the volume you are configuring. Which of the follo
dangina [55]

Answer:

b. Database server

Explanation:

Three Usage Types are involved with Data Deduplication:

General purpose file server/Default -which is tuned specifically for general purpose file servers.

Hyper-V - tuned specifically for VDI(virtual desktop infrastructure) servers.

Backup - tuned specifically for virtualized backup applications, example Microsoft DPM

8 0
3 years ago
Other questions:
  • If I deal seven cards from a standard deck of 52, what is the chance that I will get two triples (three of a kind) and one other
    11·2 answers
  • Which type of rock is created when lava cools and hardens?
    5·2 answers
  • What is the meaning of Android
    12·2 answers
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·1 answer
  • In Windows applications, a ____ control is commonly used to perform an immediate action when clicked.a. text boxb. buttonc. wind
    7·1 answer
  • Annalise received financial aid offers from two universities. Financial Analysis for Option A Costs per Year Financial Aid Packa
    8·2 answers
  • Why should you be chosen over someone else? *
    5·2 answers
  • Which of these tools can best be used as a self assessment for career planning purposes?
    6·2 answers
  • From the philosophical standpoint, especially in the discussion of moral philosophy or ethics, why do we consider “murder” or “k
    9·1 answer
  • True or false<br>Y axis is also known as the value X.​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!