Advertisement
dprincef

Untitled

May 15th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. students = int(input('Enter the number of Students: '))
  2. i = 1
  3. dic = {}
  4.  
  5. while i <= students:
  6.     inp = input("Enter the names and marks of the Student:  ").split(' ')
  7.     dic[inp[0]] = inp[1:]
  8.     i += 1
  9.  
  10. get_item = input('Enter the name of the Student to calculate the Average: ')
  11. for k,v in dic.items():
  12.    test_list = [int(i) for i in v]
  13.    dic.update({k:test_list})
  14. if get_item in dic.keys():
  15.    
  16.     n = dic[get_item]
  17.     print(sum(n)/len(n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement