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
lukranit [14]
3 years ago
6

Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z if the variable x is greater than 100.

python
Computers and Technology
1 answer:
Semenov [28]3 years ago
3 0

Answer:

if x > 100:

    y = 20

    z = 40

Explanation:

This line checks if variable x is greater than 100

if x > 100:

This line assigns 20 to y

    y = 20

This line assigns 40 to z

    z = 40

You might be interested in
Once artwork is inserted into a placeholder, it can be moved around on a slide. True False
inn [45]

Answer:

The answer to this question is true.

Explanation:

The artwork is used on the PowerPoint for making the presentation more effective. The artwork is also known as Clip Art. In the Microsoft PowerPoint, the clip art is a collection of media files like image file, video file, an audio file, and an animation file. If our computer has an Internet connection, then we can add new clip art for free. If we use the artwork or clip art on slide So it can be moved around on the slide.

6 0
3 years ago
What is output by the following C# code segment?int temp;temp = 180;while ( temp != 80 ) {if ( temp > 90 ) {Console.Write( "T
Artemon [7]

Answer:

This porridge is too hot! This porridge is just right!

Explanation:

I am going to explain every line of the given C# code to give explanation of the output.

  • The first statement int temp declares a variable temp.
  • Then the temp variable is assigned a value 180.
  • The block of statement in while loop body will keep executing until the value in temp variable gets equal to 80. The while loop first checks if the value of temp is not equal to 80. As the value of temp=180 which is not equal to 80, this means that the condition of while loop evaluates to true so the block of code in the body of the loop is reached.
  • There is an if condition inside while loop which checks if the value in temp variable is greater than 90. As value of temp=180 which is greater than 90 so the condition is true.
  • As the condition in the if statement evaluates true so the block of code which is the part of this if statement will be executed:

             {Console.Write( "This porridge is too hot! " );

                  temp = temp – ( temp > 150 ? 100 : 20 ); }

  • The first statement is executed which displays this message: This porridge is too hot!
  • Next   temp = temp – ( temp > 150 ? 100 : 20 ); statement will change the value of temp. It has the conditional operator which works as follows:

                 Here, temp>150 is the condition to be evaluated.

  • If this condition is True then 100 will be returned else 20 will be returned. The value returned is then subtracted from the value of temp and the subtraction result will become the new value of temp. As the value of temp which is 180 is greater than 150 so 100 is returned and is subtracted from the value of temp (180).

                                        temp= 180-100

                                             temp=80

  • So the new value of temp is 80.
  • The else part will not be executed because the condition in if statement was true and also we can see that temp is not less than 70. It means that the porridge is too cold part will not be executed.
  • The while loop while(temp!=80) will again be checked. As the new value of temp is now 80, so the condition gets false which breaks the while loop and program control will leave the body of while loop.
  • After the control comes out of the while loop, there is another if statement. This statement checks if the value of temp variable is equal to 80. It is true as the new value of temp is now 80 after that execution of while loop block of code.
  • As the if condition evaluates to true the statement

                    Console.WriteLine( "This porridge is just right!" );

       will be executed which displays the message:

                                  This porridge is just right.

  • Hence the output of the given code is:

           This porridge is too hot! This porridge is just right!

7 0
3 years ago
Pls help I will give points
Brrunno [24]

Answer:

Desktop

Explanation:

3 0
3 years ago
COMPUTER ORGANIZATION &amp; ARCHITECTURE I question 3<br> need correct the answers to all
evablogger [386]
Is there anything about this question?
4 0
3 years ago
At year end, Clean123 Inc. has 45500 in cash, 55000 in accounts receivable, 54400 in service equipment, 550 in prepaid insurance
Inessa [10]
Oh ok so yea and why you should but I
8 0
2 years ago
Other questions:
  • Technology has changed the way functions are performed in the law office. Which function has been the least affected by technolo
    10·1 answer
  • Which of the following statements is false? a. Each object of a class shares one copy of the class's instance variables. b. A cl
    11·1 answer
  • Which of the following tends to be true of silent film acting as opposed to sound film acting?
    7·1 answer
  • The array s of ints contain integers each of which is between 1 and 1000 (inclusive). write code that stores in the variable ord
    9·1 answer
  • If you turn on the Lock alpha button , what happens
    5·2 answers
  • So can u please follow my new ig acc i just started it yesterday its called stunnerspamz
    5·2 answers
  • What is ‘Software Testing’?
    13·1 answer
  • When compared to defender and analyzer firms, early adopters of new technologies tend to be?
    13·2 answers
  • Assume that an array named salarySteps whose elements are of type int and that has exactly five elements has already been declar
    12·1 answer
  • What is a command-line program?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!