The following code shows how to Find the Difference Between Minimum and Maximum Elements in a List in Python. As can be seen in the code, first we create a list with given values. After that, we create two variables min and max. Also, we assign the first element of the list in these two variables. Further, we update these variables in a loop that iterates over all elements of the list. Here, we check the conditions to find minimum, and maximum respectively in two different conditional statements. In other words, if any element is smaller than the value of min, it will be assigned to the variable min. Likewise, we update the variable max. Hence, when the loop completes the variables min and max contains the minimum and maximum values respectively. Finally, we compute the difference between these two values.

mylist=[7, 12, 90, 11, 55, 84, 5, 58, 377, 121, 69, 39, 29]
print('list elements: ')
for i in range(len(mylist)):

print('Finding minimum and maximum in the list...')
for i in range(len(mylist)):
   if min>mylist[i]:
   if max<mylist[i]:
print('Minimum element: '+str(min))
print('Maximum element: '+str(max))
print('Difference between Minimum and maximum: '+str(diff))


The Output of the code to Find Difference Between Minimum and Maximum Elements in a List in Python
The Output of the code to Find Difference Between Minimum and Maximum Elements in a List in Python

Further Reading

Deep Learning Tutorial

Text Summarization Techniques

How to Implement Inheritance in Python

Find Prime Numbers in Given Range in Python

Running Instructions in an Interactive Interpreter in Python

Deep Learning Practice Exercise

Python Practice Exercise

Deep Learning Methods for Object Detection

Understanding YOLO Algorithm

What is Image Segmentation?

ImageNet and its Applications

Image Contrast Enhancement using Histogram Equalization

Transfer Learning and its Applications

Examples of OpenCV Library in Python

Examples of Tuples in Python

Python List Practice Exercise

Understanding Blockchain Concepts

Edge Detection Using OpenCV

Predicting with Time Series

Example of Multi-layer Perceptron Classifier in Python

Measuring Performance of Classification using Confusion Matrix

Artificial Neural Network (ANN) Model using Scikit-Learn

Popular Machine Learning Algorithms for Prediction

Long Short Term Memory – An Artificial Recurrent Neural Network Architecture

Python Project Ideas for Undergraduate Students

Creating Basic Charts using Plotly

Visualizing Regression Models with lmplot() and residplot() in Seaborn

Data Visualization with Pandas

A Brief Introduction of Pandas Library in Python

A Brief Tutorial on NumPy in Python