Advertisement
zyulfi

Min_num_list

Jun 5th, 2025
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | Source Code | 0 0
  1. # Задача 2
  2. # Напишете функция, която намира минимума в списък от цели числа. Списъкът се подава като параметър.
  3. # Резултатът се връща от функцията.
  4.  
  5. def min_num_of_list (list_num):
  6.     split_list = list_num.split(",")
  7.     min_num = int(split_list[0])
  8.     for element in range(1, len(split_list)):
  9.         if min_num > int(split_list[element]):
  10.             min_num = int(split_list[element])
  11.     return min_num
  12.  
  13. num_list = input("Please enter list of integer: ")
  14.  
  15. print(f"The smallest number specified in the list is: {min_num_of_list(num_list)}")
Tags: Min_num_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement