Sort by

recency

|

3815 Discussions

|

  • + 0 comments
    print("{:.2f}".format(sum(x for x in student_marks[query_name])/3))
    

    Use "{:.2f}".format(number) instead of round(number) to make sure trailing zeros are also printed

  • + 0 comments

    It looks like the task involves reading a dictionary containing student names as keys and their respective marks as values. cricbet99 com

  • + 0 comments

    if name == 'main': n = int(input()) student_marks = {} for _ in range(n): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = input() avg=sum(student_marks[query_name])/len(student_marks[name]) print(f"{avg:.2f}")

  • + 0 comments
    if __name__ == '__main__':
    n = int(input())
    student_marks = {}
    for _ in range(n):
    name, *line = input().split()
    scores = list(map(float, line))
    student_marks[name] = scores
    query_name = input()
    student_scores = student_marks.get(query_name)
    
    print(format(sum(student_scores)/len(student_scores),".2f"))
    
  • + 0 comments

    I'm printing the expected output using following code but the test does't pass

    marks = student_marks.get(query_name);
    total = 0;
    for i in marks : 
        total = total + i;
    print( f'{total/3 : .2f}')
    

    Edit: nvm, removing the spaces in print to print( f'{total/3:.2f}') fixed it. The input/expected output UI format doesn't display these spaces though