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 new laptop was delivered to your home and left on the porch while you were at work. It is very cold outside, and you don't kno
kifflom [539]

Answer:

Let the computer warm up to room temperature before turning it on.

Explanation:

The laptop has been shipped to the user's home when he were at work and found on the deck. Outside it is really cool and he don't remember how long it has been there. Then, the user open his laptop and want to know whether it is functioning properly. Instead, let the machine warm up while switching it on to room temperature.

When a computer is still in a cold climate, they have to let it heat up to room temperature apx. 6-24 hours before switching it on. Otherwise, its heat the elements generate could cause water moisture within the laptop. That water could then harm elements of the system.

7 0
3 years ago
In minecraft Education Edition what is the crafting recipe for Balloons and Glow sticks?
schepotkina [342]

Answer

sorry I only know how to make balloons :(

Explanation:

For the balloons the recipe that one is:

- you will need 6 latex

To make latex you will need two different elements one is 5 Carbon and the other one is 8 Hydrogen ( don't use crafting table to do it use the compound creator)

-Dye ( whatever color you want)

-Helium

-lead

Instructions

on the crafting table the latex will go on the sides (3 on the left and 3 on the right). The dye goes on top, the Helium in the middle and the lead at the bottom and there you go a balloon

8 0
3 years ago
Read 2 more answers
During the design phase, development teams translate the requirements into?
Ludmilka [50]
A design for the software application
7 0
3 years ago
What is custom software
Kobotan [32]
A custom sofware is a computer program or website written <span>specifically for your company,</span>
4 0
3 years ago
Read 2 more answers
There are___standard colors for text in a theme.
Stella [2.4K]
There are two standard colors for a text in a them
6 0
3 years ago
Other questions:
  • In 2–3 sentences, describe how you would insert a table into a word-processing document.
    9·2 answers
  • List some good names for devices on your home network or on the network in your school's lab. Demonstrate the use of best practi
    13·1 answer
  • The chief reason that family and friends are frequent targets of aggression is that
    6·1 answer
  • Write a program that asks the user for three names, then prints the names in reverse order.
    5·1 answer
  • A 10-foot ladder must make an angle of 30° with the ground if it is to reach a certain window. What angle must a 20-foot ladder
    9·2 answers
  • Assume that an array of integers named a that contains exactly five elements has been declared and initialized. Write a single s
    15·1 answer
  • 50 POINTS &amp; A FOLLOW!
    11·2 answers
  • NAND is logically complete. Use only NAND gates to constructgate-level circuits that compute the
    7·1 answer
  • What is a project?
    5·2 answers
  • PLTW IM Chapter 1.2-1.3 i need this please
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!