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
Valentin [98]
3 years ago
5

Need help on Assignment 4: Evens and Odds

Computers and Technology
1 answer:
Sliva [168]3 years ago
8 0

n = int(input("How many numbers do you need to check? "))

even = 0

odd = 0

for x in range(n):

   num = int(input("Enter number: "))

   if num % 2 == 0:

       even += 1

       print(str(num) + " is an even number.")

   else:

       odd += 1

       print(str(num) + " is an odd number.")

print("You entered " + str(even) + " even number(s).")

print("You entered " + str(odd) + " odd number(s).")

This works for me. Best of luck.

You might be interested in
Name the box where the name of the first cell of the selected range appears?
sergey [27]

Answer:

Name box

Explanation:

From the picture, the name box is at the top left corner with B1 written inside, here B1 is written because it is the active cell at the time which also happens to be the first cell of the selected range. The name box can be used to easily create a named ranges rather Than having to draw the mouse over a group of cells. It also helps to know which cell is the current active cell as the cell address in the name box is the active cell at any point in time.

4 0
3 years ago
Consider Ron’s budget. How much money does Ron have left over each month?
vladimir1956 [14]
What is Ron’s budget?
4 0
3 years ago
Read 2 more answers
Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable
levacccp [35]

Answer:

if (pH<7.0){

          neutral=0;

          base=0;

          acid=1;

      }

      else if (pH>7.0){

          neutral=0;

          base=1;

          acid=0;

      }

      else if (pH==7.0){

          neutral=1;

          base=0;

          acid=0;

      }

Explanation:

As required by the question, if and else statements have been used to test the value of the pH and assign the apropriate values to the variables neutral, base and acid.

The code snippet below can be used to prompt the user to enter values for pH

<em>import java.util.Scanner;</em>

<em>public class pHTest {</em>

<em>   public static void main(String[] args) {</em>

<em>      Scanner scr = new Scanner(System.in);</em>

<em>       System.out.println("Enter a value for the pH");</em>

<em>       int neutral, base, acid;</em>

<em>       double pH = scr.nextDouble();</em>

<em> if (pH<7.0){</em>

<em>           neutral=0;</em>

<em>           base=0;</em>

<em>           acid=1;</em>

<em>       }</em>

<em>       else if (pH>7.0){</em>

<em>           neutral=0;</em>

<em>           base=1;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>       else if (pH==7.0){</em>

<em>           neutral=1;</em>

<em>           base=0;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>} }</em>

4 0
3 years ago
Read 2 more answers
SHOW ME SOME C++ TUTORIALS?
german
Google c++ tutorial. Cplusplus and Tutorials Point both have some good resources
4 0
3 years ago
Jasmine took many pictures at a photo shoot. She wants to transfer these pictures from her camera to her laptop for image enhanc
hoa [83]
The answer would more likely be A
If it’s not correct I’m very sorry
5 0
2 years ago
Other questions:
  • Match each feature to whether it influences audio or video quality
    6·1 answer
  • You have been asked to create an authentication security plan for your company. Which of the following components would you inco
    14·1 answer
  • What does a transistor do?
    13·2 answers
  • 30 POINTS Conduct Interviews
    11·1 answer
  • What is the purpose of inserting SmartArt in a Microsoft Office program? (1 point)
    11·2 answers
  • What are the three major functions of a game engine?
    15·1 answer
  • Which of the following people choose a career path for the right reasons
    12·2 answers
  • Terminal emulation, especially the unprotected ____________________ protocol, should be blocked from any access to all internal
    9·1 answer
  • The users in your organization bring their own mobile devices to the office and want to be able to access the network with them.
    10·1 answer
  • Write an algorithm to display your name 10 times​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!