+ 10

[ASSIGNMENT] One Liner to find the largest out of three numbers using Ternary Operator !

Write a program to input three numbers by the user, then write a single statement which checks all the three numbers and finds the greatest amongst them. Printing of the largest number can be done in an extra line. Important part is the single line which will check the numbers and find the greatest one. Good Luck to all !!!! :) PS: You could use Ternary operator as well to write the single line statement. Aaron Stone

11th Feb 2018, 6:43 AM
Aaron Stone
Aaron Stone - avatar
20 Answers
11th Feb 2018, 7:09 AM
Deepesh Choudhary
Deepesh Choudhary - avatar
+ 21
Flash We all know what is One Line Code! most of us have answered the assignment where the ternary operator is used. Please, read the task and see what is being asked to write in OneLine! the codes in one line are not simply clean to read in other languages and are not nice, at least for me! so everyone is trying to improvise with code in order to make the helpful one. >>Important part<< is the Single Line Which Will Check the Numbers and Find the Greatest One! PS : You could use 》Ternary operator《 as well to write the => single line statement! <=
28th Apr 2018, 2:20 PM
MeanMachine
MeanMachine - avatar
22nd Feb 2018, 10:23 PM
MeanMachine
MeanMachine - avatar
+ 18
https://code.sololearn.com/cMAFbpjsawyE/?ref=app
27th Apr 2018, 8:52 AM
Danijel Ivanović
Danijel Ivanović - avatar
27th Apr 2018, 6:03 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 11
https://code.sololearn.com/cKyzYzeq2chD/#py
11th Feb 2018, 7:17 AM
Cool Codin
Cool Codin - avatar
11th Feb 2018, 2:45 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 6
Great guys !!
11th Feb 2018, 7:56 AM
Aaron Stone
Aaron Stone - avatar
+ 6
Nice work everyone !
18th Feb 2018, 10:35 AM
Aaron Stone
Aaron Stone - avatar
2nd May 2018, 10:41 AM
Naveen Maurya
Naveen Maurya - avatar
+ 5
One liners r normally messy, and purpose is to reduce the size of the code, not to make it readable. Writing in a single line and one-liners r not same as far as I understand (def x(s) : return s —- is it a one-liner? Don’t think so, by definition it means done with the execution of the program in one line). Of course! I didn’t use ternary. But assignment header is bit confusing and the way people titled their solutions. Nonetheless, I didn’t mean to offend anyone. Just expressed my point of view.
28th Apr 2018, 3:17 PM
Flash
+ 5
Flash Don't worry, it's okey☺. No one is offended. 😉 You are expressing your point of view, same we are. Good luck!! ✌👌👍
28th Apr 2018, 4:27 PM
Fabio
+ 4
MeanMachine is right. What is asked to be in one liner is just the check of the numbers. So the solutions in here are ok. My complete one liner code: https://code.sololearn.com/cryq3d9V7zpN/?ref=app
28th Apr 2018, 3:06 PM
Fabio
+ 3
https://code.sololearn.com/c2xVIuE4R7C1/?ref=app https://code.sololearn.com/cx0E1kcqbc46/?ref=app
11th Feb 2018, 10:21 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 3
No offense but none of the entries seems to be a “one-liner”. In my opinion this is called one-liner: #written by flash in python (works on any number of inputs) [print(max(list(map(int, input().split()))))]
28th Apr 2018, 1:44 PM
Flash
+ 2
Hello, everyone! In Python it is rather simple with the built-in function max(), but I used some comparison in a second version. https://code.sololearn.com/cb6NOXj31MVx/
12th Feb 2018, 1:25 PM
Pedro Maimere
Pedro Maimere - avatar
+ 1
Max=a>b?a:b>c?b:c;
11th Feb 2018, 8:59 PM
Navneet kumar
Navneet kumar - avatar
+ 1
👍🏼
3rd May 2018, 2:37 AM
Lily Uriza
Lily Uriza - avatar