write a python program that takes sale for four quarters then displays total sales when average sales made
Answers
Source code:
q1 = float(input("Enter the sales for quarter 1: "))
q2 = float(input("Enter the sales for qaurter 2: "))
q3 = float(input("Enter the sales for quarter 3: "))
q4 = float(input("Enter the sales for quarter 4: "))
ts = q1 + q2 + q3 + q4
avgs = ts/4
print("Total sales: " ts)
print("Average sales: ", avgs)
The float() data type is most preferable since we're attaining prices, that could come in decimal values. float() is also preferable since we can't be sure that the total value will be fully divisible by 4.
Answer:
Source code:
q1 = float(input("Enter the sales for quarter 1: "))
q2 = float(input("Enter the sales for qaurter 2: "))
q3 = float(input("Enter the sales for quarter 3: "))
q4 = float(input("Enter the sales for quarter 4: "))
ts = q1 + q2 + q3 + q4
avgs = ts/4
print("Total sales: " ts)
print("Average sales: ", avgs)
The float() data type is most preferable since we're attaining prices, that could come in decimal values. float() is also preferable since we can't be sure that the total value will be fully divisible by 4