+ 1

Can you put more numbers in a int(input())

https://code.sololearn.com/c0sOxyO3UhCF/?ref=app

4th May 2021, 7:37 PM
Dico
3 Respuestas
+ 2
Something like this? (Give multiple numbers separated by space.) for example, INPUT: 5 2 8 4 3 OUTPUT: the largest number is 8 [CODE] Largest_so_far = 0 print("""choose numbers above 0 for which you want to know which is the largest. Separate numbers with, """) for the_num in [int(i) for i in input().split()]: if the_num > Largest_so_far: Largest_so_far = the_num print(Largest_so_far, the_num) print('this is the Largest number', Largest_so_far)
4th May 2021, 7:41 PM
RKK
RKK - avatar
+ 5
Dico , here some thoughts about a possible solution: ▪︎getting the input as int numbers in a list could be done like: nums_list = [int(i) for i in input().split()] # input like: 4 23 0 43 11 (separated by space) ▪︎when you have got the input numbers in the list, you can get the largest number by using max() print(max(nums_list))
4th May 2021, 7:58 PM
Lothar
Lothar - avatar
+ 2
Thanks a lot
4th May 2021, 7:43 PM
Dico