-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaverage.py
More file actions
32 lines (22 loc) · 790 Bytes
/
Copy pathaverage.py
File metadata and controls
32 lines (22 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Author: Juan A Wagner
# Date : 4/01/2021
# Description: A program that takes 5 inputs from the user and finds the average
# need to initialize temp variable for summation, otherwise the first addition will not be uniform.
temp = 0
print("Please enter 5 numbers.")
# asks the user for 5 numbers, adding them one by one
user_data = input()
temp = temp + float(user_data)
user_data = input()
temp = temp + float(user_data)
user_data = input()
temp = temp + float(user_data)
user_data = input()
temp = temp + float(user_data)
user_data = input()
temp = temp + float(user_data)
#calculates the average of the collected values
average = temp/5
# returns the average with a message for the user
print("The average of those numbers is:")
print(average)