you can improve your code adding an initial sorting and utilizing the index function. code:
your_physics_point = int(input('please insert your point: '))
#solve:
#first check
if your_physics_point not in class_points :
print('your inserted point is NOT found!')
else:
#sort the list decreasing
class_points.sort(reverse=True)
#create a dict
scale = {1: "first", 2: "second", 3:"thrid", 4:'fourth', 5:'fifth'}
#find the index
ind = class_points.index(your_physics_point)
#printing
print('you are ' + scale[ind+1] + '!')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.