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%.
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)
Comments
Leave a comment