I am currently writing a program that outputs the lowest and highest numbers of an input_list.
currently I am using
list_of_num = [input_list for input_list in input("Input 4 numbers separated by comma's to find the lowest and highest numbers:\n").split(",")]
to separate the numbers input by a user, and then converting to a list to compare the numbers individually.
This is done by using:
maximum_output_number = list_of_num[0]
for y in range(len(list_of_num)):
# if the other element is max then last element.
if list_of_num[y] > maximum_output_number:
maximum_output_number = list_of_num[y]
then simply printing the maximum_output_number.
so E.G. input(20,-40,-10,14.5) would output "the highest number in the list is 20" etc.
However, I want to include the option that if a user inputs the word "generate", the program will use
random.sample(range(-1000000, 1000000), 4)
to generate a list and then use that generated list to output the highest and lowest numbers.