<> Python Run Code Input 1 number1=int(input()) 2 number2=int(input()) 3# Write your code here 2 2 Output Your code didn't print anything. Task Using the print Method Complete the Python code to take two integers as the user input and print their average. The formula of the average is as follows: Average = $(a + b)/2$ Sample Input: 2 2 Sample Output: 2.0
Added by Bradley A.
Close
Step 1
This is already done in the given code. Second, we need to calculate the average of these two numbers. The formula for the average is (number1 + number2) / 2. Show more…
Show all steps
Your feedback will help us improve your experience
Christian Otero and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Problem 1: Write a Python program that calculates the average of three integer values. Prompt the user to enter three integers, your program should calculate the average and display it.
Shelayah R.
(Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. *********** USE PYTHON ********* Sample Run 1 Sample Output 1: Enter an integer, the input ends if it is 0: 1 Enter an integer, the input ends if it is 0: 2 Enter an integer, the input ends if it is 0: -1 Enter an integer, the input ends if it is 0: 3 Enter an integer, the input ends if it is 0: 0 The number of positives is 3 The number of negatives is 1 The total is 5 The average is 1.25 Sample Run 2 Sample Output 2: Enter an integer, the input ends if it is 0: 0 No numbers are entered except 0
Write a python program that computes and prints the average of the numbers in a text file. You should make use of two higher-order functions to simplify the design.
K S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD