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
liberstina [14]
4 years ago
5

Python

Computers and Technology
1 answer:
xeze [42]4 years ago
3 0

Answer:

Following are the function to the Python Programming Language.

#define a function to read or crates the list

def GetUserValues():

 my_list=[]

 n=int(input("Enter range: "))

 for i in range(n):

   my_list.append(int(input(" :")))

 return my_list

#define a function to check the elements of the list

def IsListEven(mylist):

 #set the for loop

 for i in range(len(mylist)):

   #set if condition to check odd number

   if mylist[i]%2 !=0:

     #if condition is true retun false

     return False

 #otherwise return true

 return True

#define a function to check the elements of the list

def IsListOdd(mylist):

 #set the for loop

 for i in range(len(mylist)):

   #set if condition to check even number

   if mylist[i]%2==0:

     #if condition is true retun false

     return False

 #otherwise return true

 return True

#set variable to store list

l=GetUserValues()

#set if condition to check the function is true

if IsListOdd(l)==True:

 #then, print the message

 print("all odd")

#set elif condition to check the function is true

elif IsListEven(l)==True:

 #then, print the message

 print("all Even")

else:

 #otherwise print message.

 print("not even or odd")

<u>Output:</u>

Enter range: 5

:2

:4

:6

:8

:10

all Even

Explanation:

Here, we define a function "GetUserValues()" and inside the function.

  • Set the list data type variable "my_list" then, get input from the user in the variable "n".
  • Set the for loop which starts from 0 and end at the variable "n" then, get input from the user and appends inputs in the variable "my_list".
  • Then, we return list and close the function.

Then, we set a function "IsListEven()" and pass an argument "mylist" to check the elements is even or not, if the list elements is even then, return true otherwise, return false.

Then, we set a function "IsListOdd()" and pass an argument "mylist" to check the elements is odd or not, if the list elements is odd then, return true otherwise, return false.

Finally, we call and store the function in the variable "l" then, set conditions to check the list is even print "all even", if the is odd "all odd" otherwise, print "not even or odd".

You might be interested in
Will, there be any presents this year
garri49 [273]

Answer:

no why

Explanation:

8 0
3 years ago
Outline three factors to consider in selecting a suitable storage medium for your documents<br>​
jeka94

Answer:

There are three major considerations when looking at storage: function (how storage is used and accessed), capacity & speed, and reliability

6 0
3 years ago
Choose the correct function to yield the shown result.
HACTEHA [7]

Answer:

int

Explanation:

Correct on edg test 2021

8 0
3 years ago
A page layout technique that often uses a percentage value for width is called ________.
masya89 [10]
It is called a fluid layout

A fluid web page typically is configured with percentage widths that sometimes take up 100% of the browser. They will use relative units like percentages instead of pixels and will often fill the width of the page regardless of what the width of the browser might be. They keep the same spatial weighting to all elements and works fine on different sizes of screens of similar sort. They define each area of an image layout perfectly.  




4 0
4 years ago
Univariate linear regression Note: Solutions to this problem must follow the method described in class and the linear regression
salantis [7]

Answer:

regression line is  Y  =    124.9281    +    0.9370    *x

SSE=    (SSxx * SSyy - SS²xy)/SSxx =     7317401.270      

Explanation:

See the attached image file

4 0
3 years ago
Other questions:
  • Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
    14·1 answer
  • Which examples demonstrate appropriate use of media for a school project? Check all that apply. showing cartoons to teach about
    6·2 answers
  • System requirements that are important in determining if a software program will work on a computer are ____.
    8·1 answer
  • Which spreadsheet operation does a look function perform?
    5·1 answer
  • _____ is an effort by an employee to attract attention to a negligent, illegal, unethical, abusive, or dangerous act by a compan
    8·1 answer
  • Encapsulate the following Python code from Section 7.5 in a function called my_sqrt that takes a as a parameter, chooses a start
    7·1 answer
  • Please answer the following essay question:
    13·1 answer
  • 6 → What is the difference between SHA-256 and SHA-512?
    12·1 answer
  • What sort of technique would you use to sort 10,000 items using just 1000 available slot in your RAM?
    6·1 answer
  • Who would benefit from using self-driving cars
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!