''' noodle.py DS2000 Spring 2022 Computing the number of bones days per week! :) ''' BONES_FILE = "bones_days.txt" BONES_SUMMARY = "bones_summary.txt" def main(): # Step one -- gather data from the file with open(BONES_FILE, "r") as infile: week_one = int(infile.readline()) week_two = int(infile.readline()) week_three = int(infile.readline()) week_four = int(infile.readline()) week_five = int(infile.readline()) week_six = int(infile.readline()) # Step two -- computations (average the bones days) total = week_one + week_two + week_three + week_four + week_five + week_six avg = total / 6 # Step three -- communicate the result print("Average number of bones days/week:", round(avg, 3), "\n\n") # Step one --- gather data from the summary file with open(BONES_SUMMARY, "r") as infile: desc_one = infile.readline().strip() total_bones_days = int(infile.readline()) desc_two = infile.readline().strip() pct_bones = float(infile.readline()) desc_three = infile.readline().strip() pct_no_reading = float(infile.readline()) # Step two --- computation, actual number of bones days bones_days = pct_bones * total_bones_days # Step three -- communication! print(desc_one, ":", total_bones_days) print(desc_two, ":", pct_bones) print(desc_three, ":", pct_no_reading) print("Total number of bones days...", round(bones_days)) main()