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
disa [49]
3 years ago
15

Why might a variable used for output have to be of a different type then a variable used for input?​

Computers and Technology
1 answer:
telo118 [61]3 years ago
7 0

Answer:

You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.

Explanation:

Your input may have to be different then output varying on what data you are processing.

For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.

Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.

Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.

Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:

<u>Code (Python)</u>

def IsSmart(gpa):

  if (gpa >= 4):

       return True

  else

       return False

As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.

You might be interested in
Before you insert a page break, what should you do? select the font you want to use for the text that comes after the page break
Triss [41]
Put the insertion point where you want the page to break is what I would write.
7 0
2 years ago
What is a good coding site
Helga [31]

Sratch.com

-Agarvated

6 0
2 years ago
Picture question please help me
cluponka [151]

Answer:

where is the picture?????

6 0
2 years ago
Read 2 more answers
13. You're doing research for a paper. When would you use an indirect citation?
Whitepunk [10]

Answer:

D

Explanation:

d is the answer

5 0
2 years ago
What will be the output of the following query on the table below?
shtirl [24]

Answer:

b

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Use the STL class vector to write a C function that returns true if there are two elements of the vector for which their product
    14·1 answer
  • Which network topology requires terminators at the ends of the backbone cable?
    6·1 answer
  • During an experiment, if you purpose change the temperature to test a hypothesis the temperature is called what??
    6·1 answer
  • ​this is another name for the wireless configuration in which a central wireless device is used to serve all wireless clients.
    13·1 answer
  • assume that you want to sort an array have 100000 elements which algorithm (insert sort algorithm or quick sort algorithm) is th
    12·1 answer
  • Why are computers useful for modeling situations?
    13·2 answers
  • Chegg Suppose the heap is a full tree, size 2^n-1. what is the minimum number of steps to change a min heap to a max heap. Show
    5·1 answer
  • Write a C program that right shifts an integer variable 4 bits. The program should print the integer in bits before and after th
    15·1 answer
  • 3.5 Code Practice: Question 1 edhesive
    6·1 answer
  • HELP 20 points THIS IS ON EDGE IF YOU DON'T KNOW THE ANSWER DON'T RESPOND
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!