Skip to content

Instantly share code, notes, and snippets.

@bikashthapa01
Created April 1, 2019 02:51
Show Gist options
  • Save bikashthapa01/4d3dbc52262128e6105bdc5e5b5cb659 to your computer and use it in GitHub Desktop.
Save bikashthapa01/4d3dbc52262128e6105bdc5e5b5cb659 to your computer and use it in GitHub Desktop.
n = int(input("Enter No Of Students: "))
studentData = {}
for x in range(n):
usn = input(f"Enter Usn of {x} student: ")
marks = int(input("Enter Marks: "))
studentData[usn] = marks
# creating list from dictonary
marks = list(studentData.values())
maxi = max(marks) # maximum marks
mini = min(marks) # minimum marks
morethan60 = []
morethan75 = []
morethan85 = []
lessthan60 = []
# finding range
for k,v in studentData.items():
if v > 85 and v <= 100:
morethan85.append(k)
elif v > 75 and v <=85 :
morethan75.append(k)
elif v > 60 and v <= 75:
morethan60.append(k)
else:
lessthan60.append(k)
for k,v in studentData.items(): #iterating through values
if maxi == v:
print("Maximum Marks: ",k,v)
if mini == v:
print("Minimum Marks: ",k,v)
print("More Than 85 ")
for x in morethan85:
print(x)
print("More Than 75 ")
for x in morethan75:
print(x)
print("More Than 60 ")
for x in morethan60:
print(x)
print("Less Than 60 ")
for x in lessthan60:
print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment