Assignment 4: Evens and Odds

Write a program that will ask a user for how many numbers they would like to check. Then, using a for loop, prompt the user for a number, and output if that number is even or odd. Continue doing this as many times as the user indicated. Once the loop ends, output how many even numbers were entered and how many odd numbers were entered.

Hint: For a number to be even, when the number is divided by 2, there should be no remainder - so you will want to use the modulus (%) operator.

Hint: You will need two count variables to keep track of odd and even numbers.

Sample Run 1
How many numbers do you need to check? 5
Enter number: 20
20 is an even number.
Enter number: 33
33 is an odd number.
Enter number: 4
4 is an even number.
Enter number: 77
77 is an odd number.
Enter number: 8
8 is an even number.
You entered 3 even number(s).
You entered 2 odd number(s).
Sample Run 2
How many numbers do you need to check? 3
Enter number: 10
10 is an even number.
Enter number: 3
3 is an odd number.
Enter number: 400
You entered 2 even number(s).
You entered 1 odd number(s).

Benchmarks
Prompt the user to answer the question, “How many numbers do you need to check? “
Create and initialize two count variables - one for odd and one for even.
Based on the previous input, create a for loop that will run that exact number of times.
Prompt the user to “Enter number: “
If that number is even, output “[number] is an even number.”
Update the even count variable.
Or else if the number is odd, output “[number] is an odd number.”
Update the odd count variable.
Output “You entered [number] even number(s).”
Output “You entered [number] odd number(s).”

Answers

Answer 1

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

odd = 0

even = 0

i = 0

while i < 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")

   i += 1

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

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

I hope this helps!

Answer 2

The program allows user to enter a specified number of values and displays if the number is even or odd ; The program written in python 3 goes thus :

num_inputs = int(input('number of inputs : '))

#prompts user to enter a specified Number of inputs

count = 1

#keeps of the number of inputs supplied

while count <= num_inputs :

#iterate using a while loop

your_num = int(input('Enter a number : '))

#prompts user to enter an integer value

count+=1

#increase counter by 1

if your_num%2 == 0 :

#checks if number is even

print('even number')

else:

print('odd number')

A sample run of the progam is attached below.

Learn more :https://brainly.com/question/20720413

Assignment 4: Evens And OddsWrite A Program That Will Ask A User For How Many Numbers They Would Like

Related Questions

Does anybody know the answer to 5.7.5: Factorial of Code HS? I can’t figure it out

Answers

In this exercise we have to use the knowledge of computational language in JAVA to describe a code, like this:

The code can be found in the attached image.

To make it easier the code can be found below as:

function myFunction(num){

n = 0;

total = 1;

while (n < num){

  total *= (num - n);

  n+=1;

}

return total;

}

alert(myFunction(6));

See more about JAVA at brainly.com/question/2266606

inputs and outputs that allow a user to interact
with a piece of software

Answers

I do not understand what you are asking

What number will be output by the console.log command on line 5?
A. 10
B. 25
C. 30
D. 35

Answers

Answer:

The output is 35

Explanation:

Required

Determine the output on line 5

We start by analysing the program line by line.

On line 1: kit = 20

On line 2: roo = 10

On line 3: kit = kit + 5

Substitute 20 for kit.

So, we have

kit = 20 + 5

kit = 25

On line 4:

roo = kit + roo

Substitute values for kit and too

roo = 25 + 10

roo = 35

On line 5: Output roo

So, 35 is displayed as an output

What does the following loop do? val = 0 total = 0 while (val < 10): val = val + 1 total = total + val print( total)

Answers

Answer:

print(total) => 45

Explanation:

# smells like Python...

val = 0 #initialize incrementor named 'val' at 0.

total = 0 #initilize accumulator named 'total' at 0.

while (val < 10): #look to execute while val is less than 10.

 val = val + 1 #increment val (val++) by 1

  total = total + val #increment total by val (val+=total)

# Step: val = 0

## val => 1, total => 1

# Step: val = 1

## val => 2, total => 3

# Step: val = 2

## val => 3, total => 5

# Step: val = 3

## val => 4, total => 9

# Step: val = 4

## val => 5, total => 14

# Step: val = 5

## val => 6, total => 20

# Step: val = 6

## val => 7, total => 27

# Step: val = 8

## val => 9, total => 36

# Step: val = 9

## val => 10 (END_LOOP), total =>  45

print(total) #print variable 'total'

What prevents someone who randomly picks up your phone from sending money to themselves using a messenger-based payment?

Answers

Answer:

Explanation:

There are various safety features in place to prevent such scenarios from happening. For starters phones usually have a pin code, pattern code, or fingerprint scanner which prevents unauthorized individuals from entering into the phone's services. Assuming that these features have been disabled by the phone's owner, payment applications usually require 2FA verification which requires two forms of approval such as email approval and fingerprint scanner in order for any transactions to go through. Therefore, an unauthorized individual would not have access to such features and would not be able to complete any transactions.

The feature which prevents someone who randomly picks up your phone from sending money to themselves using a messenger-based payment is:

Security features like passwords or authentication codes

In a messenger-based payment system, there exists various safety features which prevents unauthorised use of the system to send money fraudulently. Some of these features include:

PasswordsPersonal Identification Number (PIN)Two factor authentication (2FA)

As a result of this, we can see that these features prevent someone from making unauthorised money transfers.

Read more here:

https://brainly.com/question/19469131

The internet's data pathways rely on what kind of hardware device to route data to its destination?
servers
O ISPs
O routers
O IP addresses

Answers

Answer:

It is B router

Explanation:

Routers help with getting the WIFI from the ISP Internet Service Provider and then distribute it across your house-workplace  

Answer:

Explanation:

Edge 2022

Write a program that prompts the user to input a positive integer. It should then output a
a message indicating whether the number is a prime number.
(Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd
integer less than or equal to the square root of the number.)

Answers

num = -1

count = 0

while num < 0:

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

if num % 2 == 0:

   if num == 2:

       print(str(num)+" is a prime number")

   else:

       print(str(num)+" is not a prime number")

else:

   for x in range(1, int(num**0.5)+1,2):

       if num % x == 0:

           count += 1

   if count > 1:

       print(str(num)+" is not a prime number")

   else:

       print(str(num)+" is a prime number")

I hope this helps!

PLEASE HELP!!! 18 points

Write the SQL query that would search a table called Movies and return the titles
of movies that were made in 1975.

Answers

Answer:

Vertigo                                            |     1958 |      128 | English         | 1958-08-24 | UK

   902 | The Innocents                                      |     1961 |      100 | English         | 1962-02-19 | SW

   903 | Lawrence of Arabia                                 |     1962 |      216 | English         | 1962-12-11 | UK

   904 | The Deer Hunter                                    |     1978 |      183 | English         | 1979-03-08 | UK

   905 | Amadeus                                            |     1984 |      160 | English         | 1985-01-07 | UK

   906 | Blade Runner                                       |     1982 |      117 | English         | 1982-09-09 | UK

   907 | Eyes Wide Shut                                     |     1999 |      159 | English         |            | UK

   908 | The Usual Suspects                                 |     1995 |      106 | English         | 1995-08-25 | UK

   909 | Chinatown                                          |     1974 |      130 | English         | 1974-08-09 | UK

   910 | Boogie Nights                                      |     1997 |      155 | English         | 1998-02-16 | UK

   911 | Annie Hall                                         |     1977 |       93 | English         | 1977-04-20 | USA

   912 | Princess Mononoke                                  |     1997 |      134 | Japanese        | 2001-10-19 | UK

   913 | The Shawshank Redemption                           |     1994 |      142 | English         | 1995-02-17 | UK

   914 | American Beauty                                    |     1999 |      122 | English         |            | UK

   915 | Titanic                                            |     1997 |      194 | English         | 1998-01-23 | UK

   916 | Good Will Hunting                                  |     1997 |      126 | English         | 1998-06-03 | UK

   917 | Deliverance                                        |     1972 |      109 | English         | 1982-10-05 | UK

   918 | Trainspotting                                      |     1996 |       94 | English         | 1996-02-23 | UK

   919 | The Prestige                                       |     2006 |      130 | English         | 2006-11-10 | UK

   920 | Donnie Darko                                       |     2001 |      113 | English         |            | UK

   921 | Slumdog Millionaire                                |     2008 |      120 | English         | 2009-01-09 | UK

   922 | Aliens                                             |     1986 |      137 | English         | 1986-08-29 | UK

   923 | Beyond the Sea                                     |     2004 |      118 | English         | 2004-11-26 | UK

   924 | Avatar                                             |     2009 |      162 | English         | 2009-12-17 | UK

   926 | Seven Samurai                                      |     1954 |      207 | Japanese        | 1954-04-26 | JP

   927 | Spirited Away                                      |     2001 |      125 | Japanese        | 2003-09-12 | UK

   928 | Back to the Future                                 |     1985 |      116 | English         | 1985-12-04 | UK

   925 | Braveheart        

Explanation:

hope this helped please mark me branliest let me know if you have questions :)

In news writing, which is bigger , a topic or a angle

Answers

Answer: A topic

Explanation:

News writing has to do with when people write for publication which can be in a magazine, newspaper, etc. A topic simply means the subject that a writer or s person is discussing or writing on. The topic helps in having an idea on what the paragraph will be about.

The angle of a particular story or new simply means the point of the story. Angle is the viewpoint through which writers typically share their stories.

It should be noted that the topic is bigger as it is more detailed than the angle.

The process of sending a result back to another part of the program is
known as returning the value.

Answers

Answer:

The process of sending a result back to another part of the program is known as pushing a value False In Python, functions and other resources are coded in components called modules

Explanation:

Which UAS construction material is the lightest, easiest to shape, and easiest to repair?

a. plastic

b. titanium

c. foam

d. fiberglass

Answers

Answer: Plastic

Explanation:

It is light weight, easy to repair, malleable, and used for many easy to use products.

Answer:

Plastic

Explanation:

What type of business document is used to
communicate inside the company?

Answers

Answer:

Where’s your answer choices

Explanation:

Put it in the comments and I’ll do the same

importance of using information and communication technology in personal life

Answers

Answer:

ICT has a great impact in our daily lives. ... It can improve the quality of human life because it can be used as a learning and education media, the mass communication media in promoting and campaigning practical and important issues, such as the health and social area.

Explanation:

Which method returns the time at the user's location?
localtime()

usertime(0

gmtime()

time()

Answers

Answer:

localtime()

Explanation:

it is right

Answer:

Time

Explanation:

The power of if worksheet

Answers

what are you talking about?

MS Excel is word processing software true or false​

Answers

Answer:

Explanation:

Microsoft Excel is a spreadsheet program used for calculations, making charts and recording data about all sorts of business processes.

Answer:

false

Explanation:

Microsoft Excel is a spreadsheet program used for calculations, making charts and recording data about all sorts of business processes.

4.11 lesson practice edhesive questions 4 and 5​

Answers

Answer:

It may just be me but I can't see the picture

Explanation:

Answer:

4. Monte carlo simulations

I need the answer for number 5 please.

Explanation:

Help me!!

Find and enter the correct amount. 5 9 of a $18 restaurant bill = $

Answers

Answer:

Calculate a tip or gratuity and get the total amount to pay. Enter your meal or dinner cost along with the tip percentage.  If you are splitting the cost at a restaurant among several people you can divide by the number of people to get the total cost each.  Optionally round the results to dollars.

BRAINLIEST PLEASE

Tip = Cost * 0.xx

Total including Tip = Cost * 1.xx Explanation:

Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
click From File
click Insert
right-click the picture
click Picture
select the desired picture and again click Insert
write the caption and add it
click Insert Caption











Answers

Answer:

-Click insert

-Click picture

-Click from file

-Right click the picture

-Select the desired picture and again click Insert

-Click insert caption

-Write the caption and add it

Explanation:

Answer:

B: by right-clicking the bottom row, clicking Insert, then clicking Insert Row Below

Explanation:

A thesaurus is an example of a(n)

A)blog.
B)e-book.
C)e-zine.
D)online reference.

Answers

Answer:

D. online reference

Explanation:

An "online reference" refers to a digital reference that end users may utilize for their work or other daily activities. For example, if a person is looking for the synonym of a particular word, she may then refer to the thesaurus.

A blog is a website where you can find personal journals from different writers.

An e-book is an "electronic book." This allows people to read book digitally.

An e-zine is an "electronic magazine." This is a magazine in its digital form.

Answer:

online reference :)))

Explanation:

What are the default page settings for a Google Doc? *

Answers

Wym sir/ma’am (Click File > Page Setup. Change the page size to A4. Click Set as default) if that’s what you need

Fill in the blank to complete the sentence.
If you only want to use the localtime function, you can load just that one function into active memory using the following line of code.

from________ import localtime()

Answers

Answer:Explanation:

its time

The Basic Input-Output Operating System (BIOS), which is stored in the computer's read-only memory (ROM) microchip, reads the time from the memory in the real-time clock chip when the computer is turned on.

What is the local time function relation with active memory?

The local time() function transforms a time value expressed in seconds to a Tm structure. The local time() method transforms a time val to job locale time using an assumption that the time val is in Universal Coordinate Time (UTC).

A real-time clock (RTC) is a battery-operated clock that is built into a motherboard microchip.

The term “the CMOS” is frequently used to refer to this microchip, which is typically distinct from the microprocessor and other chips (complementary metal-oxide semiconductor).

Therefore, you can load just that one function into active memory using the line of code.

Learn more about local time here:

https://brainly.com/question/28149671

#SPJ2

Which method allows you to choose how to display the date and time?

localtime()

time()

strftime()

format()

Answers

The method that allows you to choose how to display the date and time is the format. The correct option is d.

What is a display?

The display is the screen of electronic devices. It is a display that is a computer output surface and projecting mechanism that presents text and frequently graphic pictures to the computer user.

It only has two possible values: black or white. The image's white color will be displayed as "white," while the other colors will be displayed as black. Once more, only the black and other colored things have changed; the white portion has not. The image's true color would be displayed.

A file format is a format of data that is stored in proper encoding. It also tells the information about bits used in the formation.

Therefore, the correct option is d. format.

To learn more about the display, refer to the link:

https://brainly.com/question/8566172

#SPJ2

Answer: "format()"

Explanation: Did it myself :)

what is the main purpose of a web crawling program
A.two index web pages for quick retrieval full of content B.turn create meta tags for web contact C. to search illicit or illegal web activity D.to convert keywords to HTML
Please ANSWERRRRR​

Answers

Answer:

the answer is A because Web crawlers enable you to boost your SEO ranking visibility as well as conversions.

Explanation:

Write a scientific explanation that explains how we know the tectonic continental plates are not in the same location today that they were in the past.

Answers

Answer:

Im not a 100% sure this is correct.. but ill try my best!

Explanation:

The tectonic plates where orignally connected in Pangaea. The plates begein to move apart, causing earthquakes, and physical features. If it whernt for the tectonic plates moving, Pangaea would still exist today showing clear evidence they most likley had moved.

Differentiate between traditional majlis and modern majlis...
GIVE IN TABE FORM

Answers

Answer:

Traditional majlis

The traditional Majlis is usually a large room that is either separate from the main house or in the house but with its own entrance. This is largely due to the Arabic traditions which values the privacy of the house. Since the Majlis often has its own separate entrance you have to design a welcoming entryway.

Modern majlis

The modern majlis design is delicate and luxuriously styled. The quality of the materials and their combinations are an important part of the style. Small details, gold inserts, rims, carved moldings create the desired luxury of the   attention to ceiling illumination and lights fixtures.

Explanation:

Which of the following is not one of the four criteria for evaluating websites?

Question 1 options:

currency


content and accuracy


validity


authority

Answers

Answer:validity

Explanation:

Because it dont sound right

The option that doesn't belong to the criteria that can be used to  evaluate websites is C: validity.

evaluation of  websites can be regarded as the way to determine the value of information that can be found on the Internet.

Criteria that can be used in evaluation are;

Accuracy: this explains the reliability as well as correctness of the contentRelevance: this describe how important is the needed informationCurrency: this serve as the time period for the information.Authority:  this serve as source of the information.

Therefore, option C is correct.

Learn more at:

https://brainly.com/question/2510490?referrer=searchResults

middle of test help pls
Which of the following could be a possibility in the future?


A voice-activated computers

B computerized glasses

C holographic messages

D computerized watches

Answers

Answer:

I'm thinking d

Explanation:

i dont think we are advanced enough to do a,b, or c.

so imma say d

Answer:

all

Explanation:

Jasmine wrote a program where the actor does things in order. Which term best describes this program?
O sequential
Oselection
Oconditional
Oiteration

Answers

Answer:

Sequential

........................

Answer:

sequntial

Explanation:

How can we work together to fix problems with our websites

Answers

Add a Value Proposition. ...
Website Navigation. ...
Call to Action Text. ...
Call to Action Colors. ...
Try The 10-Foot Test. ...
Carousels. ...
Social Proof. ...
Testimonial Pages.

The question "How can we work together to fix problems with our websites" is not peculiar to programmers who are consulted to solve a website problem.

The best response to the question includes we will"

add a value propositioncreate a website navigationcall to action textcall to action colorstry the 10-foot testuse a social proofcreate a testimonial pages.

Read more about website problem

brainly.com/question/25537936

Other Questions
How might population density be related to the amount of damage caused by an earthquake? Which accurately identifies the beliefs of the Whig and Democratic parties?Whigs supported states rights, while Democrats opposed them.Whigs supported westward expansion, while Democrats opposed it.Whigs supported protective tariffs, while Democrats opposed them.Whigs supported slavery in the West, while Democrats opposed it. Part A Consider the Similar triangles below :B 4 6, A, 7, CQ, 12 , P , RFind the scale factor :Part B : Find the length of side PR Choose the correct formatting based on the information about the title/work in this sentence.I wish there were a new episode of the podcast ______ more often than every two weeks.Choose 1 answer:Choose 1 answer:(Choice A)AThe Adventure Area(Choice B)BThe Adventure Area 9. We saw an interesting documentary on ...... life.a. salineb. caninec. maritimed. marine10. Teenagers are often more likely to be influencedby their ...... than their elders.a. peersb. subjectsc. lonersd. adolescents Which of the following best describes the roles of Betsy in "Wealthier than Kings" and the speaker's love in "Sonnet 29"?O Betsy and the speaker's love force Adrianna and the speaker to focus less on their own futures and more on the futures of othersO Betsy lends a supporting hand and many uplifting words, while the speaker's love provides little support or joy to the speakerBetsy is disappointing to Adrianna and the absence of the speaker's love makes the speaker even fuller of despairBetsy and the speaker's love make Adrianna and the speaker realize that their lives are full of hope, promise, and immense valuePreviousSearch for anythingo.ASUS VivoBook Bok Sanctuary in Lake Wales, FL, has a carillon tower that is 205 feet tall. Heather made a scale drawing of the tower using the scale 1 inch : 20 feet. In which proportion does h represent the height, in inches, of Heather's scale drawing? Why is it important as a healthcare worker to understand the different stages of grief as it relates to end of life care ? A crate is being pushed at a constant velocity. What force are being used? rename 3.5 as a mixed number The entire participial phrase in the following sentence is . Hiding in the brush, the leopard was not seen by the hunters. 3 A ball is thrown haizonatallyoft a 7m building at omisA man wants to catch theball in a basket 1sm of theground How ker away from thebuilding should he stand withthe basket? Suppose a merchant wastraveling from Egypt toMesopotamia. In which directionwould he travel?Plz Hurry! SECTION A1. The perimeter of a pallalelogram is 38cm. If one of the aide is 12 cm. Findother side (a) 7cm (b) 9cm (c) 13cm 762. What did the FBI falsify for distribution to the Oklahoma press during the Vietnam War?A a proposed constitutional amendment to crack down on war protestersB. a letter from an OSU parent calling war protesters "immoral" and "criminalC. a news release critical of the president's Vietnam War policiesD. a top-secret study revealing Americans' condemnation of the war in Vietnam A July sales forecast projects that 9,000 units are going to be sold at a price of $11.00 per unit. Management forecasts 2% growth in sales each month. Total August sales are anticipated to be:_______a. $76,950.b. $71,250.c. $68,400.d. $67,500.e. $74,100. what factors determine the rate of weathering What is the sugar in a DNA nucleotide? Which of the following is a force or motion that is involved in the Moon orbiting Earth? A. a force pulling the Moon toward the center B. a speed at right angles to the line from the mass of the Moon to the center of Earth C. acceleration toward the center of Earth D. all of the above A restaurant has 26 tables in its dining room. It takes the waitstaff 10 minutes to clear and set 4 tables. At this rate, how long (in minutes) will it take the waitstaff to clear and set all the tables in the dining room.