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

Consider the following code: x = int(input("Input an integer: ")) if (x >= 0): print("Yay!") else: print("Boo!") It outputs "

Yay!" if the value is positive and "Boo!" if the value is negative. Change the condition so that it only outputs "Yay!" if the value is non-negative (i.e. zero or positive) and even. x >= 0 and x % 2 == 0 x >= 0 and x % 2 == 1 x >= 0 or x % 2 == 1 x >= 0 or x % 2 == 0.
Computers and Technology
1 answer:
Fed [463]3 years ago
7 0
<h2>You have to apply the given condition in if loop.</h2>

Explanation:

if((x>=0) && (x%2==0))  

print("Yay!")

else

print("Boo!")

if((x>=0) && (x%2==0))  this statement is enough to check given expectation. the value of x is positive that is checked using  x>=0 and also the positive integer should be an even number is checked using the condition (x%2==0). The "&&" operator is used to check whether both the condition is true. So if the value of "x" is positive and even, "Yah!" will be printed. Otherwise "Boo!" will be printed.

All the other choice goes invalid becoz (x%2==1) will be true only if the number is an odd number.

You might be interested in
What is the shortest sequence of MIPS instructions that extracts a field for the constant values of bits 7-21 (inclusive) from r
mixer [17]

Answer:

What is the shortest sequence of MIPS instructions that extracts a field for the constant values of bits 7-21 (inclusive) from register $t0 and places it in the lower order portion of register $t3 (zero filled otherwise)? - sll$t0, $t3, 9# shift $t3 left by 9, store in $t0

srl $t0, $t0, 15# shift $t0 right by 15

Explanation:

The shortest sequence of MIPS instructions that extracts a field for the constant values of bits 7-21 (inclusive) from register $t0 and places it in the lower order portion of register $t3 (zero filled otherwise) is shown below:

sll$t0, $t3, 9# shift $t3 left by 9, store in $t0

srl $t0, $t0, 15# shift $t0 right by 15

4 0
3 years ago
OO<br>(A) 3 and 5<br>(B) 4 and 8<br>(C) 2 and 0<br>(D) 6 and 9<br>2. There are twelve books on a shelf and four children in a ro
dlinn [17]

Explanation:

2.there will be 8 books left on the shelf if each child takes one

8 0
3 years ago
 Formulas within table cells always begin with
Delicious77 [7]
(D) I don't know about other spread sheet software, but in Microsoft Excel, a formula is always entered beginning with an 'equals' sign. ( = ).
4 0
3 years ago
For things like school, you should have a more serious:
german

Answer:

who and what do you mean

Explanation:

7 0
3 years ago
Which type of game controller has a set of controls for each hand?
svet-max [94.6K]
If you play the Wii, they have the controller and then they have a nunchuck that connects to the other controller, and you use that with your other hand. Hope that helps :)
6 0
3 years ago
Other questions:
  • A(n) _____ is a fake online persona created to promote a particular point of view, often in praise of a firm, product, or indivi
    15·1 answer
  • Which three of the following are requirements for receiving federal financial aid for college education?
    14·2 answers
  • You have no control over who views your social network information
    13·2 answers
  • The following is the pseudocode for which type of algorithm? For start = each array subscript, from the first to the next-to-las
    6·1 answer
  • Which of the following would be an appropriate use of a check box control?
    15·1 answer
  • Write down the bit pattern to represent -3.75 assuming a version of this format, which uses an excess-16 format to store the exp
    14·1 answer
  • Please help,it’s a year 9 question
    7·1 answer
  • What charts the cost to the company of the unavailability of information and technology and the cost to the company of recoverin
    15·1 answer
  • You are dropping your friend back home after a night at the movies. From the car, she turns on the indoor lights in her home usi
    9·1 answer
  • Which of the following is a document view you can select using Button on the status bar?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!