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

Python

Computers and Technology
1 answer:
xeze [42]3 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
Need Help! Asap 7.5 code practice (Edhesive)
erma4kov [3.2K]

Answer:

Make main function

def main():

Make some constants for the grades

A = 5.0 or 4.0

B = 4.0 or 3.0

C = 3.0 or 2.0

D = 2.0 or 1.0

F = 1.0 or 0.0

In the main function call the function you made and make sure to use those constants for help

also don't forget to call your main function or nothing will work

Explanation:

Making the main function is good programming practice for your future

Making the constants is also helpful to your programming.

Now how it works you call the function you wrote to calculate the grade.

I don't know how helpful this was this is one of my first answers. I am `also answering how I would do it

5 0
2 years ago
Read 2 more answers
What is the primary reason for compressing video files?
11111nata11111 [884]

Answer:

Decrease file size

Explanation:

This goes for almost every file you compress. If you compress it, you try to decrease the storage space it takes up as a way to make it more portable. After a compressed file is extracted, it does not have many effects on the state of the extracted file.

4 0
3 years ago
What is the effective address generated by the following instructions? Every instruction is
kaheart [24]
D. Mov ax, [bx+si] is your answer
5 0
2 years ago
An analyst suggests that the lower the number of clusters, would give us the strongest and most meaningful result, as opposed to
WARRIOR [948]

Answer:

a. True

Explanation:

Various studies have shown that this is true. Clusters allow you to group together large sets of data into smaller groups in order to find similarities between all the data. Having a smaller number of clusters has been proven to allow you to discover much simpler similarities which can have a much greater impact. Larger sets can help in discovering more unique similarities but they do not have as large of an impact and are less meaningful. This is also why it is recommended to have a lower number of clusters when analyzing data sets.

4 0
3 years ago
You are managing a global news website which has a very high traffic. To improve the performance, you redesigned the application
Shalnov [3]

Answer:

The load balancer did not receive the availability zone properly, which is why it could not receive any traffic.

Explanation:

The availability zone was not properly added to the load balancer, that was why there was no traffic at all, this is a logical data center that prevents any incident of two data centers failing simultaneously. When the availability zone is not properly added to the load balancer, the load balancer will be down.

6 0
3 years ago
Other questions:
  • In an ha configuration, which two failure detection methods rely on icmp ping? (choose two.)
    12·1 answer
  • How can development in ICT be utilized to speed up the development and integration efforts
    15·1 answer
  • A department manager would like to choose an access control model in which the owner of a resource decides who may modify permis
    8·1 answer
  • In Windows Vista, the Run command can be found in which application?
    6·1 answer
  • There are a few simple rules that you can follow to store and manage files and folders in your computer. What is the most import
    9·2 answers
  • GAMER OYUNCU KOLTUĞU % YERLİ
    6·1 answer
  • The number of pixels displayed on the screen is known as ​
    12·1 answer
  • For this assignment, select one of the organizations with a prominent IT department from the Topic 1 assignment. Once identified
    11·1 answer
  • 1.) Florida has ____________ roads that are designated as part of the National Highway System.
    12·1 answer
  • An entrepreneur wants to make an app to show what breeds of dogs are similar to each other. She wants to look at factors such as
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!