This Python program is designed to solve a problem where we need to calculate the average of scores. The scores are inputted as a list of floats, and the number of students and subjects are also provided. The program uses Python's built-in zip function to transpose the list of scores, and then calculates the average for each student.
CodeRankGPT is a tool powered by GPT-4 that quietly assists you during your coding interview, providing the solutions you need.
In real-time and absolutely undetectable 🥷
The solution works by first taking the number of students and subjects as input. It then takes the scores for each subject as input and stores them in a list. The zip function is used to transpose the list of scores, effectively grouping the scores of each student together. The program then iterates over these grouped scores, calculates the average for each student by summing the scores and dividing by the number of subjects, and prints the result.
N, X = map(int, input().split())
scores = []
for _ in range(X):
scores.append(list(map(float, input().split())))
for i in zip(*scores):
print(sum(i) / len(i))
If you have a HackerRank coding test coming up, you can use CodeRankGPT to your advantage. It will assist you during your interview and help ensure you get the job.
AI is here now, and other candidates might be using it to get ahead and win the job. 🧐
The form has been successfully submitted.