Here's a Python program that finds the greatest number from a list of n numbers:
Python# Get the input list from the user
num_list = []
n = int(input("Enter the number of elements in the list: "))
for i in range(n):
num = int(input("Enter element {}: ".format(i+1)))
num_list.append(num)
# Find the greatest number in the list
greatest_num = num_list[0]
for i in range(1, n):
if num_list[i] > greatest_num:
greatest_num = num_list[i]
# Print the greatest number
print("The greatest number in the list is:", greatest_num)
In this program, I first get the input list from the user by asking for the number of elements and then prompting the user to enter each element one by one. I then use a loop to iterate through the list and find the greatest number by comparing each element with the current greatest number. Finally, I print the greatest number to the console.
Output for the Python program that finds the greatest number from a list of n numbers:
PythonEnter the number of elements in the list: 5
Enter element 1: 45
Enter element 2: 34
Enter element 3: 87
Enter element 4: 12
Enter element 5: 65
The greatest number in the list is: 87
In this example, the user enters a list of 5 numbers and the program outputs the greatest number in the list, which is 87.