Answer the question
In order to leave comments, you need to log in
How to find the largest value from a list?
Good afternoon! Help me solve the task, I don’t understand how to use input () here so that it receives values \u200b\u200bfrom the user and displays the largest one?
Task:
Write a program that will ask for input numbers (comma-separated on one line) and print the largest value from the list.
Restriction: You cannot use a ready-made function for finding the maximum (for example, max() ), ready-made functions and sorting methods (for example, sort() , sorted() ), the set() function .
Input format: 1, 2, 3, 6, 7
Output format: 7
Answer the question
In order to leave comments, you need to log in
max_number = float('-inf')
[(max_number := i) for i in map(int, input().split(',')) if i > max_number]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question