Question

Complete the Python program below that performs the following operations. First prompt the user to input two integers, n and

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

n = int(input("Enter a integer: ")) m = int(input("Enter a integer: ")) if n<m : #for loop for traversing the numbers for i in range(1,m): #it check the no is odd or not if i % 2 != 0: #if no is odd then print it print(i, end = " ") if m<n : for i in range(1,n): #it check the no is even or not if i%2==0 : #if no is even then print it { print(i, end = " ") }

Output:

Enter a integer: 10 Enter a integer: 5 2 4 6 8Enter a integer: 10 Enter a integer: 10Enter a integer: 5 Enter a integer: 10 1 3 5 7 9i wrote this program according to your specifications it take two numbers from the user and then check the condition and then print appropriate number.i provide you editable code and output also.

Add a comment
Know the answer?
Add Answer to:
Complete the Python program below that performs the following operations. First prompt the user to input...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java program that performs these operations Prompt the user to enter a low height...

    Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...

  • 1. Prompt the user for one of the arithmetic operators ('op'): +, -, *,/, or **...

    1. Prompt the user for one of the arithmetic operators ('op'): +, -, *,/, or ** 2. Prompt the user for two input integers ('a' and'b') 3. The input numbers can be positive or negative 4. Perform the arithmetic operation using the two input numbers 5. The first entered number ('a') is the left side, the second ('b') the right side of the operation For exponentiation, the first number is the base, the second the exponent Print (display) the following...

  • Write a PYTHON program that allows the user to navigate the lines of text in a...

    Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...

  • urgent Help needed in python program ! Thanx # This is a function definition. You can...

    urgent Help needed in python program ! Thanx # This is a function definition. You can ignore this for now. def parse_integer_list_from_string(string): """ Returns a list of integers from a string containing integers separated by spaces. """ # Split the line into a list of strings, each containing a number. number_string_list = string.split() # Create an empty list to store the numbers as integers. numbers = [] # Convert each string to an integer and add it to the list...

  • Python Error: Writing a program to complete the following: Prompt the user for the name of...

    Python Error: Writing a program to complete the following: Prompt the user for the name of an input file. Open that file for input. (reading) Read the file using a "for line in a file" loop For each line,  o print the line and compute and print the average word length for that line. Close the input file Sample output: MY CODE IS WRONG AND NEED HELP CORRECTING IT!!! ------------------------------------------------------------------------------------------------------------------------ DESIRED OUTPUT: Enter input file name: Seasons.txt Thirty days hath September...

  • use C++ please 1. Vowels and Consonants Write a program that asks the user to input...

    use C++ please 1. Vowels and Consonants Write a program that asks the user to input three different integers. Write a function called numberStyle for this program that will accept each integer (one at a time) and return the following . If the integer is even, return 1 . If the integer is odd, return -1 . If the integer is zero, return O In main, after calling the function output the appropriate message describing the integers ing the function...

  • Write a program that will loop ten times. In each iteration prompt user to enter an...

    Write a program that will loop ten times. In each iteration prompt user to enter an integer between -50&50. Print the input, keep a running sum of the inputs, and track the minimun and maximum numbers input. After the loop is complete, minimum number entered, maximum number entered, sum of all numberes entered, and average of all numbers entered. Format all output. Before running the loop, print the label "Input values: ". Within the loop, print value entered by user...

  • Exercise 9.2 Write a Python program that collects from the user a single integer. Have the...

    Exercise 9.2 Write a Python program that collects from the user a single integer. Have the program print “EVEN” if the integer is divisible by 2, and “ODD” if the integer is not divisible by two. [Use the % operator to compute the two’s modulus (remainder of division by two)] Exercise 9.3 Write a Python program that collects from the user two integers. Have the program print “Yes” if the two integers are BOTH greater than 10. Do nothing if...

  • 1. Write and debug a MIPS program that performs the following operations . Prompt for and...

    1. Write and debug a MIPS program that performs the following operations . Prompt for and input three integers "a", "b and "c" using syscalls (3 points) Print all numbers starting from "a" upto "b" (including, but not exceeding "b") at an increment equal to value of"c"(5 points) If ba, then no numbers are printed, and a message is printed to inform it to the user. (3 points) Print the number and average of the generated numbers printed. (3 points)...

  • Swapping Values in python Summary In this lab, you complete a Python program that swaps values...

    Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT