-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsloan_hw5.txt
104 lines (63 loc) · 2.27 KB
/
sloan_hw5.txt
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Create Header Variable
header = ("* Welcome! This is homework 5 for Sebastian Sloan Due 10/13/2022*")
print(header)
print("")
print("")
# Instructions
print("Below you will be asked to input any 5 numbers of your choosing")
print("Please input each number one at a time, then the program will total and average of")
print("your numbers for you, Thank you!")
print("")
print("*PLEASE NOTE!: numbers entered will only be counted")
print("to the second decimal place.")
print("")
print("")
print("")
print("")
# Create Inputs
firstNum = input("Please input any number:")
print(round(float(firstNum),2))
print("")
secondNum = input("Please input any number:")
print(round(float(secondNum),2))
print("")
thirdNum = input("Please input any number:")
print(round(float(thirdNum),2))
print("")
fourthNum = input("Please input any number:")
print(round(float(fourthNum),2))
print("")
fithNum = input("Please input any number:")
print(round(float(fithNum),2))
print("")
# Total numbers together
numberInputs = [round(float(firstNum),2), round(float(secondNum),2), round(float(thirdNum),2), round(float(fourthNum),2), round(float(fithNum),2)]
totalOfNumbers = round(sum(numberInputs),2)
print("")
print("")
print("")
print("Thank you,")
print(f"the values you entered are: {round(float(firstNum),2)}, {round(float(secondNum),2)}, {round(float(thirdNum),2)}, {round(float(fourthNum),2)} and {round(float(fithNum),2)}")
print(f"the total of the numbers you input is: {totalOfNumbers}")
print(f"the average of your input numbers is: {round(float(totalOfNumbers/5),2)}")
OUTPUT:
* Welcome! This is homework 5 for Sebastian Sloan Due 10/13/2022*
Below you will be asked to input any 5 numbers of your choosing
Please input each number one at a time, then the program will total and average of
your numbers for you, Thank you!
*PLEASE NOTE!: numbers entered will only be counted
to the second decimal place.
Please input any number:358.2685
358.27
Please input any number:2358.265
2358.26
Please input any number:1586.25469
1586.25
Please input any number:15689.2654
15689.27
Please input any number:235.2654
235.27
Thank you,
the values you entered are: 358.27, 2358.26, 1586.25, 15689.27 and 235.27
the total of the numbers you input is: 20227.32
the average of your input numbers is: 4045.46