UPSC Exam  >  UPSC Questions  >  Write a program in Python to input three numb... Start Learning for Free
Write a program in Python to input three numbers and put their average?
Most Upvoted Answer
Write a program in Python to input three numbers and put their average...
Python Program to Calculate Average of Three Numbers
• **Step 1: Input three numbers from the user**
python
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
• **Step 2: Calculate the average**
python
average = (num1 + num2 + num3) / 3
• **Step 3: Display the average**
python
print("The average of the three numbers is:", average)
• **Complete Python Program**
python
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
average = (num1 + num2 + num3) / 3
print("The average of the three numbers is:", average)

Explanation:
1. The program begins by taking input from the user for three numbers using the `input()` function.
2. These numbers are then stored in variables `num1`, `num2`, and `num3`.
3. The average of the three numbers is calculated by adding them together and dividing by 3.
4. The calculated average is then displayed to the user using the `print()` function.
This Python program efficiently calculates the average of three numbers input by the user and provides a simple and straightforward way to understand the process.
Explore Courses for UPSC exam

Top Courses for UPSC

Write a program in Python to input three numbers and put their average?
Question Description
Write a program in Python to input three numbers and put their average? for UPSC 2024 is part of UPSC preparation. The Question and answers have been prepared according to the UPSC exam syllabus. Information about Write a program in Python to input three numbers and put their average? covers all topics & solutions for UPSC 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Write a program in Python to input three numbers and put their average?.
Solutions for Write a program in Python to input three numbers and put their average? in English & in Hindi are available as part of our courses for UPSC. Download more important topics, notes, lectures and mock test series for UPSC Exam by signing up for free.
Here you can find the meaning of Write a program in Python to input three numbers and put their average? defined & explained in the simplest way possible. Besides giving the explanation of Write a program in Python to input three numbers and put their average?, a detailed solution for Write a program in Python to input three numbers and put their average? has been provided alongside types of Write a program in Python to input three numbers and put their average? theory, EduRev gives you an ample number of questions to practice Write a program in Python to input three numbers and put their average? tests, examples and also practice UPSC tests.
Explore Courses for UPSC exam

Top Courses for UPSC

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev