Answer to Question #266966 in Python for Sonu Rathore

Question #266966

Suppose there is class of 30 students who have attendance between 40-



100%. The university has decided to give the bonus attendance between



for those students who have the attendance between 70-74% to make it



75%. Identify the students those have attendance after adding the bonus



attendance. Suppose students have its Roll_no & attendance. Add the



bonus attendance to the obtained final attendance of student through



array. Use functions to solve this tasks.



Input Format



The input should contain a roll_no, and attendance of 25 students.



Output Format



For each test case, display the roll_no and increased attendance of those



students only who lies between the obtained attendance of 70-74%.

1
Expert's answer
2021-11-16T18:36:55-0500
def bonus(t):
   for k in t:
      if 70 <= t[k] <= 74:
         t[k] = 75


d = {}

n = 2
for i in range(n):
   roll = input("Enter roll number for student: ")
   att = int(input("Enter attendance for student: "))
   d[roll] = att

bonus(d)

for roll, att in d.items():
   if att == 75:
      print(roll, ":", att)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS