def count_range_in_list(li, min, max):  
    ctr = 0  
    for x in li:  
        if min <= x <= max:  
            ctr += 1  
    return ctr  
  
list1 = [10,20,30,40,40,40,70,80,99]  
print(count_range_in_list(list1, 40, 100))  
  
list2 = ['a','b','c','d','e','f']  
print(count_range_in_list(list2, 'a', 'e'))

 

相关文章:

  • 2022-12-23
  • 2021-04-28
  • 2021-10-04
  • 2022-12-23
  • 2021-12-09
  • 2021-09-14
  • 2022-12-23
  • 2022-02-05
猜你喜欢
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案