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
Hoochie [10]
3 years ago
13

Secret_num = 10 temp = secret_num + 8 #evaluate secret + 8, and put the result #in temp temp = temp * 2 #evaluate temp * 2, and

put the results #in temp temp = temp / 4 answer = temp - secret_num / 2 print(answer)
why is the result always 4 ?why doesn't it change?​
Computers and Technology
1 answer:
Lunna [17]3 years ago
7 0

The result will always be 4 because the first four lines of code gets a number k+4, where k=\frac{\text{secret num}}{2}, and the last line subtracts 4 from k+4.. therefore leaving us with the value 4.

The effect of each line is explained below:

<em>secret_num </em>= 10

Assigns the value 10 to <em>secret_num</em>

<em>temp</em> = <em>secret_num</em> + 8

Stores the value 18 in <em>temp</em>

<em>temp</em> = <em>temp</em> * 2

Stores the value 36 in <em>temp</em>

<em>temp</em> = <em>temp</em> / 4

Stores the value 9 in <em>temp</em>

<em>answer</em> = <em>temp</em> - <em>secret_num</em> / 2

Stores the value 4 in <em>answer</em>

If the reasoning were done algebraically, we would have

(((\text{secret  num} + 8)\times 2)/4)-\text{secret  num}/2\\

Where the bracket nesting reflects the sequence of operations that led to the final answer in the code

Writing it mathematically, and simplifying

\frac{2(\text{secret  num} + 8)}{4}-\frac{\text{secret  num}}{2}\\\\=\frac{2\times\text{secret  num} + 16}{4}-\frac{\text{secret  num}}{2}\\\\=\frac{\text{secret  num}}{2}+4-\frac{\text{secret  num}}{2}\\\\=\frac{\text{secret  num}}{2}-\frac{\text{secret  num}}{2}+4\\\\=4

We see that at the end, no matter what the value of <em>secret_num</em> was, the <em>secret_num</em> term still cancels out, leaving us with 4.

Learn more about Arithmetic operations here: brainly.com/question/5973382

You might be interested in
Select the correct answer from the drop-down menu. Which two technologies support the building of single-page applications? and
Nataliya [291]

Answer:

JavaScript frameworks and Ajax

Explanation:

6 0
4 years ago
One group of students did an experiment to study the movement of ocean water. The steps of the experiment are listed below.
dsp73

The lamp and the ice bag were at the same place.  
Sounds like the experiment was intended to show on a small scale ocean currents from the poles to the equator and back to the poles. The bag of ice would simulate the cold at the poles while the lamp would simulate the heat provided by the sun near the equator. With that in mind, let's look at the possible flaws and see what is likely.  
Not enough ink was added.
 * If you can see the ink, then there's enough ink. So this isn't the correct choice.  
Not enough water was taken.
 * Possibility there wasn't enough volume of water to setup a current, but not too likely since the baking dish was filled. So let's look further. 
 The dish was too small for the experiment.
 * Same as above. It might be this, but there's something more likely. 
 The lamp and the ice bag were at the same place.
 * This sounds like a winner. In the real world, the poles are cold and the equator gets more sunlight. So there's a temperature gradient. In the described setup, both the heat sink (the bag of ice) and the heat source (the lamp) were at the same location.
5 0
3 years ago
Have y’all enjoyed The new hero floryn from Mobile legends
Angelina_Jolie [31]

Answer:

yo! but I'm a ex-mobile legends

5 0
3 years ago
I NEED HELP QUICK
Serjik [45]

Answer: keeps confidential documents secure,

displays a GUI, allocates the computer's resources, and retrieves files

Explanation:

The operating system can be defined as the software installed in the system that provides the information and services to the users by controlling the hardware, software resources, and regulates the computer programs. It runs the applications and programs in the system, displays the graphic user interface for the services, stores, manipulates, and retrieves files. It prevents the unauthorized access to the data and programs by using passwords thus provides the security to the system and documents.

8 0
3 years ago
Who is the first president to use social media as part of his campaign strategy
defon

Hello

The First President to use social media is Barack Obama .

According to Wikipedia it states

"Some in the media proposed May 24, 2012, as the date when Obama became the first President to respond to questions on Twitter."

Have a blessed day

7 0
3 years ago
Other questions:
  • When data are normalized, attributes in the table depend only on the secondary key?
    5·1 answer
  • I am having trouble with logic gates(AND NOR,etc)
    8·2 answers
  • By observing human behavior,_______are able to understand the cause and effect relationship between the supply of things we want
    13·2 answers
  • An unauthorized user is a network _______ issue.
    11·1 answer
  • Write a MASM program to calculate Fibonacci numbers:
    10·1 answer
  • A soft news story and a feature story are the same thing.<br> O True<br> O False<br> HELLPP ASSAAAP
    12·2 answers
  • Select the correct answer from each drop-down menu.
    5·2 answers
  • Guys, if I'm going back to 505 and it's a 7-hour flight or a 45-minute drive how do I get to 505?
    12·1 answer
  • What is the meaning of Ram?​
    12·1 answer
  • use c , c, java or python (any one) programming language for the following programming exercises. do not call built-in library f
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!