+ 2
Can anybody help me to correct my code please?
You just need to take three numbers as input from stdin and you need to find greatest of them. Please correct me with the below code. def main(): a,b,c = input(), input(), input() print(max(a,b,c),end") main()
3 Respostas
+ 4
here an other approach, without having a fixed number of input values:
# input with a comprehension: you are not having a restriction to a fixed number of input values!!
# input is taken by n numbers, separated by comma. input is split, converted to int and then appended to the list.
lst = [int(i) for i in (input('n numbers sep. by comma: ').split(','))]
print(max(lst))
# or if list is not needed for further purpose:
print(max([int(i) for i in (input('n numbers sep. by comma: ').split(','))]))
+ 2
def main():
a, b, c = (int(input()) for _ in range(3))
print(max(a, b, c), end='')
main()