0

Challenge question

In a weather forecast, given the actual and forecasted temperatures for each day of a week, find the sum of the weather forecast inaccuracies across all days. The weather forecast inaccuracy on any day is the absolute difference of the actual temperature and the forecasted temperature. Complete the function totalForecastInaccuracy which takes in two integer arrays , denoting actual temperatures, and , denoting forecasted temperatures, across days and returns the sum of the weather forecast inaccuracies across days. Input Format The first line contains space-separated integers t1,t2....t7 The second line contains space-separated integers f1,f2...f7 Constraints Output Format Print a single integer denoting the answer. Sample Input 0 14 13 12 13 16 18 21 15 11 12 11 16 19 24 Sample Output 0 9 Default Code: #!/bin/python3 import os import sys # Complete the totalForecastInaccuracy function below. def totalForecastInaccuracy(t, f): # Return the sum of the weather forecast inaccuracies across all 7 days. if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') t = list(map(int, input().rstrip().split())) f = list(map(int, input().rstrip().split())) result = totalForecastInaccuracy(t, f) fptr.write(str(result) + '\n') fptr.close()

2nd May 2018, 4:08 PM
Anthony Perez
2 Antworten
+ 2
Anthony Perez It seems your question appears to be an assignment. Please show us your attempt and use the 8 rules to get help from the community. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community *can be a code coach solution which is meant for you to do to help you establish your skills abilities and where you need to learn... not the community *one issued by a school or other institution *one issued or created by another platform *one that appears to be in the form of a challenge that was created by you or somewhere else. Your question will be reviewed by a team of moderators and will most likely be marked for deletion. https://www.sololearn.com/Discuss/1316935/?ref=app
6th Feb 2021, 10:34 PM
BroFar
BroFar - avatar
+ 1
https://code.sololearn.com/c5PQ2ksljI30/?ref=app
2nd May 2018, 4:36 PM
Koushik Naskar
Koushik Naskar - avatar