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
Masja [62]
2 years ago
5

Lab: even/odd values in an array

Computers and Technology
1 answer:
Crank2 years ago
3 0

def input_values(new_list):

   new_list = []

   n = int(input('Enter number of values: '))

   for i in range(n):

       new_list.append(int(input('Enter values: ')))

   def is_list_even(new_list):

       for i in range(len(new_list)):

           if new_list[i]%2!=0:

               return False

           return True

   def is_list_odd(new_list):

       for i in range(len(new_list)):

           if new_list[i]%2==0:

               return False

           return True

   num=input_values()

   if is_list_even(num)==True:

       print('all even')

   elif is_list_odd(num)==True:

       print('all odd')

   else:

       print('not even or odd')

You might be interested in
Write a program that finds the largest in a series of numbers entered by the user.The program must prompt the user to enter numb
Kobotan [32]

Answer:

Here is c program:

#include<stdio.h>

#include<conio.h>

void main()

{

//Variable declaration

//array to hold 6 values you can change this as needed

float nums[6];

//integer i is for loop variable

int i;

//to hold maximum value

float max=0.0;

//clear screen

clrscr();

//iterate 6 times you can change as per your need

for(i=0;i<6;i++)

{

printf("Enter a number:");

scanf("%f",&nums[i]);

//check if entered value is greater than previous value

//if it is greater then assign it

if(nums[i]>max)

max = nums[i];

}

//print the value

printf("The largest number entered was %f",max);

getch();

}

Explanation:

4 0
4 years ago
7. Question
Zigmanuir [339]
All server side errors start with 5XX
8 0
3 years ago
What was the first e-commerce service?
docker41 [41]

The first e-commerce service would be A)Banking. Hope this helps.

8 0
4 years ago
Why does binary addition have a rule for 1 + 1 + 1 if only two numbers<br> are being added together?
dalvyx [7]

Answer:

See below

Explanation:

Because sometimes you have to 'carry' a 1 over to the ext column when adding two binary numbers

Example :

 1 1 1

<u>+1 1 1 </u>    <==== starting in the first R column add  1 + 1  to get 0 and carry 1

                then the next column you will add   1 + 1 + 1  = 1   and carry 1 again

                    then 1 + 1 + 1= 1  and carry 1 again (to column 4)  to get

1   1  1 0

5 0
2 years ago
When formatting numbers with the Comma Number Format tool, the numbers are formatted with _________.
irina [24]

Answer:

2 decimal places

Explanation:

5 0
3 years ago
Other questions:
  • He smallest network is a ______________________, which is a network of personal devices, such as the network you use when you sy
    5·1 answer
  • if the president goes for vice president after his 2 term and the present president dies is the old president the president agai
    8·2 answers
  • Why is the stateless nature of the internet a problem for shopping cart software? g?
    5·2 answers
  • What are the conditions for using still photos in a video program
    6·1 answer
  • Part cost Calculator Modify the GUI in your program to look like the following GUI. To do that you need to add the following to
    13·1 answer
  • A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
    5·1 answer
  • What is the base for a hexadecimal number system?
    11·1 answer
  • The movie polar express was critically acclaimed due to the unbelievably lifelike movements of Tom Hanks character
    13·1 answer
  • What is the CPU's role?
    15·2 answers
  • ¿Qué aspectos de impacto medioambiental e impacto social tienen relación con la poca disminución de los residuos? Es para hoy.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!