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():...
(Programming Language: Python) Complete the function remove number such that given a list of integers and...
(Programming Language: Python) Complete the function remove number such that given a list of integers and an integer n, the function removes every instance of n from the list. Remember that this function needs to modify the list, not return a new list. # DO NOT ADD ANY OTHER IMPORTS from typing import List def remove_number(lst: List[int], number: int) -> None: """ Remove every instance of number in lst. Do this *in-place*, i.e. *modify* the list. Do NOT return a...
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 is for Python programming, and I am trying to use 2 for loops to ask...
This is for Python programming, and I am trying to use 2 for loops to ask a slaesperson how many of 5 different items they sold, then the program is to calculate the total dollar amount sold. Formatting and all that aside, I am having an issue with the loops not stepping through the 2 lists at the same time. The first loop is taking all 5 entered quantities times the price of the first item, and then all 5...
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...
Implement Radix Sort using PYTHON programming language. Use one of the two options for the algorithm...
Implement Radix Sort using PYTHON programming language. Use one of the two options for the algorithm to sort the digits: Use Counting Sort or Bucket Sort. • Assume the numbers are maximum 4-digit numbers. • If using Counting Sort, you can see that your digit range is between 0 and 9 ([0…9]). • If using Bucket Sort, you will have ten buckets labeled from 0 to 9. Please add comments and explain every step carefully.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT