Question

Write a Python program that prompts a user for two integers and stores the two integers...

Write a Python program that prompts a user for two integers and stores the two integers the user types into the shell. Print the product, float division, integer division, remainder, sum, and difference of the two integers to the console. The entire equation must be printed (see below for formatting). Only display 2 digits after the decimal place for results that are floats. Include a module docstring that summarizes the program..

Sample Run 1:

Enter an integer: 5
Enter another integer: 4
5  *  4  =  20
5  /  4  =  1.25
5  //  4  =  1
5  %  4  =  1
5  +  4  =  9
5  -  4  =  1 

Sample Run 2:

Enter an integer: 1
Enter another integer: 3
1  *  3  =  3
1  /  3  =  0.33
1  //  3  =  0
1  %  3  =  1
1  +  3  =  4
1  -  3  =  -2

Homework Answers

Answer #1

SOURCE PROGRAM:

num1=int(input("Enter an integer:"))
num2=int(input("Enter another integer:"))
product=num1*num2
float_div=num1/num2
int_div=num1//num2
rem=num1%num2
add=num1+num2
sub=num1-num2
print(num1,"*",num2,"=",product)
print(num1,"/",num2,"= %.2f "%(float_div))
print(num1,"//",num2,"=",int_div)
print(num1,"%",num2,"=",rem)
print(num1,"+",num2,"=",add)
print(num1,"+",num2,"=",sub)

Note: % .2f means it will print only two decimal points

Sample input and output:

Know the answer?
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
Similar Questions
(Python Programming) Write a program that prompts a user for a positive integer and then uses...
(Python Programming) Write a program that prompts a user for a positive integer and then uses a loop to calculate and display the sum of specific fractions as follows: Let's say the user enters 5, then your program will compute: 1/5 + 2/4 + 3/3 + 4/2 + 5/1 which is 8.7.
In C++ write a program that prompts the user to enter two positive integers less than...
In C++ write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the program outputs the sum of all the prime numbers between the two integers. Two prime numbers are called twin primes, if the difference between the two primes is 2 or -2. Have a program output all the twin primes and the number of twin primes between the two integers. NEEDED OUTPUTS FOR PROGRAM: Enter two positive integers <1,000,000,000: 1 100 -1...
Python programming Write a program that prompts the user to input the three coefficients a, b,...
Python programming Write a program that prompts the user to input the three coefficients a, b, and c of a quadratic equationax2+bx+c= 0.The program should display the solutions of this equation, in the following manner: 1. If the equation has one solution, display ONE SOLUTION:, followed by the solution, displayed with4 digits printed out after the decimal place. 2. If the equation has two real solutions, display TWO REAL SOLUTIONS:, followed by the two solutions, each displayed with4 digits printed...
In Python only. Write a program that prompts the user to enter a hex character and...
In Python only. Write a program that prompts the user to enter a hex character and displays its corresponding decimal integer.
Write an application that prompts a user for two integers and displays every integer between them....
Write an application that prompts a user for two integers and displays every integer between them. Display There are no integers between X and Y if there are no integers between the entered values. Make sure the program works regardless of which entered value is larger. This is a java assignment. Pls help
Write a program that prompts the user to enter an integer number between 1 and 999....
Write a program that prompts the user to enter an integer number between 1 and 999. The program displays the sum of all digits in the integer if the input is valid; otherwise, it displays a message indicating that the integer is not between 1 and 999 and hence, is invalid. Name the program file Q1.cpp Example: if the user enters 12, sum of digits is 3. If the user enters 122, sum of digits is 5.
Write an application that prompts a user for two integers and displays every integer between them....
Write an application that prompts a user for two integers and displays every integer between them. Display There are no integers between X and Y if there are no integers between the entered values. Make sure the program works regardless of which entered value is larger. ------------------------------------------------------------------------------------------------- import java.util.Scanner; public class Inbetween {     public static void main (String args[]) {         // Write your code here     } }
Write a C program, called logic_abc.c, that prompts the user to enter three integers a, b,...
Write a C program, called logic_abc.c, that prompts the user to enter three integers a, b, c, and then computes the results of the following logical operations, in sequence: !a || !b++ && c (a-1 || b/2) && (c*=2) (a-- || --b) && (c+=2) a || !(b && --c)
Write a program (just console application, no GUI) in C# which prompts the user for an...
Write a program (just console application, no GUI) in C# which prompts the user for an integer, increments the integer by 1 and displays the result in the following format: "The given number n has been incremented to n+1" Make sure your application fails to a secure mode. That is, no matter what is the user input, the application does not terminate with an error
design a program that prompts the user to enter a positive integer number and reads the...
design a program that prompts the user to enter a positive integer number and reads the user’s input. If the user input is not a positive number, the program should prompt them repeatedly until they enter a valid input. Once a valid input is received ,the program uses a loop to calculate the sum of the digits of the user’s input and displays the sum. For example, if the user enters the number 94311, the program should print the sum...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • How could your result from GC (retention time, percent area, etc.) be affected by these following...
    asked 1 minute ago
  • QUESTION 17 What are the tasks in Logical Network Design phase? (Select five. ) Design a...
    asked 3 minutes ago
  • What is the temperature of N2 gas if the average speed (actually the root-mean-square speed) of...
    asked 12 minutes ago
  • Question One: Basic security concepts and terminology                         (2 marks) Computer security is the protection of...
    asked 25 minutes ago
  • In program P83.cpp, make the above changes, save the program as ex83.cpp, compile and run the...
    asked 33 minutes ago
  • the determination of aspirin in commercial preparations experment explain why the FeCl3-KCl-HCl solution was ased as...
    asked 45 minutes ago
  • Describe important events and influences in the life of Wolfgang Amadeus Mozart. What styles, genres, and...
    asked 48 minutes ago
  • 3.12 Grade Statistics Write a python module "school.py" that prints school information (first 3 lines of...
    asked 49 minutes ago
  • Using python, please explain. The factorial of an integer N is the product of the integers...
    asked 53 minutes ago
  • alamoto Co. manufactures a single product that goes through two processes — mixing and cooking. The...
    asked 58 minutes ago
  • QUESTION 21 _______ is the ease of use with which network users can access the network...
    asked 1 hour ago
  • Configure IP static routing using 6 pc's, 3 routers & 3 switches by using CISCO PACKET...
    asked 1 hour ago