Program:
# Takes the length of the list
count = int(input("Enter how many positive numbers you want : "))
print("Keep entering positive numbers")
nums = []
for i in range(count):
# Taking input of a number from user
nums.append(int(input("Enter a number: ")))
largest = nums[0]
for i in range(1, len(nums)):
if nums[i] > largest: # comparing the the largest element
largest = nums[i]
print("Largest number entered :", largest)
Output:
Get Answers For Free
Most questions answered within 1 hours.