Assignment 4: Evens and Odds

Students were asked over to answer a question at school and to tell what is most important for them to succeed. The one which response stood out from the rest was practice. Successful persons aren’t born successful; they become successful by just hard work and determination. This is how you can complete your goals. right below some question and answer examples that you could possibly implement to enriches your knowledge and gain insight that will help you to preserve your school studies.

Question:

Assignment 4: Evens and Odds

The program checks if user supplied integers are even or odd and displays the appropriate value. The program is written thus in python 3 ;

n_check = int(input(“How many numbers do you need to check? “))

#number of values user wishes to test

even_count = 0

odd_counts = 0

for n in range(n_check):

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

if num % 2 == 0:

#even numbers leave no remainder when divided by 2

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

even_counts+= 1

#increase count of even numbers

else:

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

odd_counts += 1

print(“You entered “+str(even_counts)+” even number(s).”)

print(“You entered “+str(odd_counts)+” odd number(s).”)

#display the number of even and odd numbers entered.

From the answer and question examples above, hopefully, they can help the student sort out the question they had been looking for and take notice of the whole thing declared in the answer above. You could possibly then have a discussion with your classmate and continue the school learning by studying the problem together with each other.

READ MORE  Explain how employee benefits affect total employment compensation.