Question

In: Computer Science

Use the Python programming language to complete below (I need the New Answer for this, and...

Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!):

Write a function to seek for all even numbers and odd numbers in the middle of two number A and B. Print even and odd numbers in 1 and 2020 (including both these two numbers)

Solutions

Expert Solution

I have uploaded the Images of the code, Typed code and Output of the Code. I have provided explanation using comments(read them for better understanding).

Images of the Code:


Note: If the below code is missing indentation please refer code Images

Typed Code:

#function called
def evenorodd():
#Even Numbers
print("Even numbers:", end = " ")
#for loop will iterate 1 to 2020
#2021 excluded
for i in range(1,2021):
#if i divided by 2 and remainder = 0
if i%2 == 0:
#printing the number
print(i,end = " ")
print("\n\n")
#Odd Numbers
print("Odd numbers:", end = " ")
#for loop will iterate 1 to 2020
#2021 excluded
for i in range(1,2021):
#if i divided by 2 and remainder = 1
if i%2 == 1:
#printing the number
print(i,end = " ")
#calling function
evenorodd()
//code ended here

Output:

If You Have Any Doubts. Please Ask Using Comments.

Have A Great Day!


Related Solutions

Use the Python programming language to complete below (I need the New Answer for this, and...
Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!): A website requests an user to input his account password. Write a program to examize the validity of the password. The valid password must consists of: At least 1 letter in [a-z] At least 1 number in [0-9] At least a letter in [A-Z] (capital) At least one special letter in [$#@] At least...
Note: I need a code and other requirement Note: programming language is c++ If you need...
Note: I need a code and other requirement Note: programming language is c++ If you need more information, please clarify what information you want. consider solving the equation sin(x) - e^(-x) = 0 write a computer program to solve the given equation using: 1- bisection method 2- fixed-point method 3- newton's intervals: {0,1},{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,8},{8,9},{9,10} choose accuracy E = 10^(-5) Make sure you document your program Requirement : 1- Mathematical justification 2- algorithem description 3- code (program) with documentation 4-output: roots ,...
I am building a game in C programming language where I need to add objects of...
I am building a game in C programming language where I need to add objects of various length into a game board. The game board is 8X8 and we must account for the boundaries for the board and not go over them with our objects. The boards upper left corner is at 0x0 and we must return 1 if it fits and -1 if it does not fit. I have the following 2 functions to start with: ```int add_object_vert(int r,...
The programming language is Python Instructions: Create a function that will delete a node in a...
The programming language is Python Instructions: Create a function that will delete a node in a Linked List based on position number. On below example, if you want to delete position #2, it will remove the Banana (arrangement of nodes below is Apple, Banana, Cherry, Grapes, Orange). myLinkedList = LinkedList() myLinkedList.append("Banana") myLinkedList.append("Cherry") myLinkedList.append("Grapes") myLinkedList.append("Orange") myLinkedList.prepend("Apple") myLinkedList.deleteByPositionNum(2) node = myLinkedList.head while node: print(node.value, " ") node = node.next_node You may start with the function head: def deleteByPositionNum(self, positionNum):
Please I need a new answer for the below questions, Due to the remarkable raise and...
Please I need a new answer for the below questions, Due to the remarkable raise and advancement of technology, lots of large companies are moving forward to digitalize and virtualize how they do business internally and externally, such as virtual teams. Moreover, one of the virtual team advantages is the ability for a company to create the dream team without boundaries as it eliminates the element of desistance, core knowledge and skills limitation. With all these wonderful components there are...
I need a program(code) in any programming language that performs the following operations: union, concatenation and...
I need a program(code) in any programming language that performs the following operations: union, concatenation and conversion DFA-NDFA.
The programming language that is being used here is JAVA, below I have my code that...
The programming language that is being used here is JAVA, below I have my code that is supposed to fulfill the TO-DO's of each segment. This code in particular has not passed 3 specific tests. Below the code, the tests that failed will be written in bold with what was expected and what was outputted. Please correct the mistakes that I seem to be making if you can. Thank you kindly. OverView: For this project, you will develop a game...
Python programming 1. Use 0 and 1 only to complete the function that outputs how many...
Python programming 1. Use 0 and 1 only to complete the function that outputs how many N-long sequence are in total. Condition 1) Starts with zero and ends with zero 2) Zero does not exist twice in a row. 3) 1 does not exist three times in a row. 4) N is a natural number. - A sequence that satisfies the conditions. ex) 010, 0110, 01010 - A sequence that does not meet the conditions. ex) 0100, 01110, 01100110 Need...
Use R programming language to answer and please so show the code as well. A paper...
Use R programming language to answer and please so show the code as well. A paper manufacturer studied the effect of three vat pressures on the strength of one of its products. Three batches of cellulose were selected at random from the inventory. The company made two production runs for each pressure setting from each batch. As a result, each batch produced a total of six production runs. The data follow. Perform the appropriate analysis. Table is below Batch Pressure...
please can you complete my answer .. Please, i need Unique answer, Use your own words...
please can you complete my answer .. Please, i need Unique answer, Use your own words (don't copy and paste). Please, don't use handwriting, Use your keyboard. Q1: 1. Explain with the help of suitable examples / graph the following:     a. ‘Production Possibility Curve’      b. The concept of ‘Opportunity Cost’      c. Distinguish between ‘Quantity Demanded’ and ‘Demand Schedule’ Answer : this is my answer i want you to complete my answer (with the help of suitable examples...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT