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...
I did the complete programming in python , just want to use tkinter for GUI. please...
I did the complete programming in python , just want to use tkinter for GUI. please look at the 2nd part . i did some part of this program using tkinter but could not finis it. Thank you. import random image = 'w' # modified functions which accepts two numbers each and returns the respective # output def add(a, b): return a + b def subtract(a, b): return a - b def multiply(a, b): return a * b def kidCalc():...
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,...
I need assistance with the below HTML5 web programming assignment. Use as many question as you...
I need assistance with the below HTML5 web programming assignment. Use as many question as you need to answer. (c) Client Lab – Exploring Form Design (25 points) The design of a form, such as the justification of the labels, the use of background colors, and even the order of the form elements can either increase or decrease the usability of a form. Visit some of the following resources to explore form design: Because of the dynamics of web sites,...
Please use the Scheme programming language with Dr. Racket to solve a and b below. (Use...
Please use the Scheme programming language with Dr. Racket to solve a and b below. (Use Scheme and not Python) Write before–in–list?, which takes a list and two elements of the list. It should return #t if the second argument appears in the list argument before the third argument: > (before–in–list? '(back in the ussr) 'in 'ussr) #T > (before–in–list? '(back in the ussr) 'the 'back) #F The procedure should also return #f if either of the supposed elements doesn't...
This lab problem demonstrates the use of import module. The Python programming language has many strengths,...
This lab problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a...
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...
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):
Programming language Python It have to be in Functions with a main function Samuel is a...
Programming language Python It have to be in Functions with a main function Samuel is a math teacher at Hogwarts School of Witchcraft and Wizardry. He loves to give his students multiplication exercises. However, he doesn’t care about the actual operation result but the unit sum of its digits. At Hogwarts School of Witchcraft and Wizardry, they define the unit sum (US) of N as the unit that it is left after doing the sum of all the digits of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT