write a program that prints the minimum and the maximum of five numbers entered by the user
Answers
Answered by
6
def _min(nums):
_min = nums[0]
for n in nums:
if _min > n:
_min = n
return _min
def _max(nums):
_max = nums[0]
for n in nums:
if _max < n:
_max = n
return _max
nums = [int(n) for n in input("enter 5 nums: ").split()]
print(f"min: {_min(nums)}\nmax: {_max(nums)}")
Answered by
2
Answer:
Solutionusingpython3
def _min(nums):
_min = nums[0]
for n in nums:
if _min > n:
_min = n
return _min
def _max(nums):
_max = nums[0]
for n in nums:
if _max < n:
_max = n
return _max
nums = [int(n) for n in input("enter 5 nums: ").split()]
print(f"min: {_min(nums)}\nmax: {_max(nums)}")
Similar questions
Accountancy,
2 months ago
English,
2 months ago
Math,
2 months ago
Social Sciences,
5 months ago
Math,
5 months ago
Math,
10 months ago
Physics,
10 months ago