- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python – Average of digit greater than K
When it is required to display average of digit greater than K, a simple iteration is used.
Below is a demonstration of the same −
my_list = [11, 17, 25, 16, 23, 18] print ("The list is :") print(my_list) K = 15 print("The value of K is ") print(K) my_count = 0 for index in my_list : if index > K : my_count = my_count + 1 print ("The result is :") print(my_count)
The list is : [11, 17, 25, 16, 23, 18] The value of K is 15 The result is : 5
A list is defined and displayed on the console.
The value for K is defined and displayed on the console.
A counter variable is created.
The list is iterated over, and every element is compared with K.
If the element is greater than K, the count value is incremented by 1.
This is the output that is displayed on the console.
- Python Indices of numbers greater than K
- Python - Consecutive Ranges of K greater than N
- Python – Remove characters greater than K
- Python - Number of values greater than K in list
- Find smallest element greater than K in Python
- Python – Filter Tuples Product greater than K
- Python - Get the Index of first element greater than K
- Python – Remove Tuples with difference greater than K
- Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold in C++
- Largest number less than N with digit sum greater than the digit sum of N in C++
- Python – Extract dictionaries with values sum greater than K
- Largest even digit number not greater than N in C++
- Count of alphabets having ASCII value less than and greater than k in C++
- Python – Extract list with difference in extreme values greater than K
- Largest subarray having sum greater than k in C++