solve a question using python functions | find max and min number | in sinhala

Опубликовано: 08 Октябрь 2024
на канале: VISECODE
6
3

findMaxNumber This function takes a list as input and returns the maximum value in the list. It initializes a variable max to the first element of the list and iterates through the list, updating max if it encounters a larger value. Finally, it returns the maximum value.

findMinNumer This function takes a list as input and returns the minimum value in the list. It initializes a variable min to the first element of the list and uses a loop to iterate through the remaining elements, updating min if it encounters a smaller value. Finally, it returns the minimum value.

numberList: This is the list of numbers you want to find the maximum and minimum values for.

print: It prints the maximum and minimum values by calling the findMaxNumber and findMinNumer functions and interpolating the results into the printed string.