Find bigges number in 3 numbers using conditional control statements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Find bigges number in 3 numbers using conditional control statements

Any changes in my code https://code.sololearn.com/cqsC4iCzfMT4/?ref=app

14th Aug 2019, 2:46 PM
Suresh
5 Answers
+ 6
you can find here an other example to calculate this (source: geegsforgeegs): # Python program to find the largest # number among the three numbers def maximum(a, b, c): if (a >= b) and (a >= c): largest = a elif (b >= a) and (b >= c): largest = b else: largest = c return largest # Driven code a = 200 b = 40 c = 30 print(maximum(a, b, c))
14th Aug 2019, 4:22 PM
Lothar
Lothar - avatar
+ 3
Your program is definitely not accurate, for example, try entering 9 6 13, and your program says that 9 is big. What you need to do is to nest conditional statements, otherwise, their are also other smart ways to do that. However, this will do as a proof of concept. https://code.sololearn.com/cE5VgWBc9BTY/?ref=app
14th Aug 2019, 4:16 PM
Naveen Maurya
Naveen Maurya - avatar
+ 2
This was the smart solution I meant by. It is particularly helpful if you do not want to preserve the values or by implementing functions. https://code.sololearn.com/c3QCxXADpoj4/?ref=app
14th Aug 2019, 4:30 PM
Naveen Maurya
Naveen Maurya - avatar
+ 2
#create empty list list = [] #for-loop to add elements from input to the list. range(3) will have you input 3 values, change it if necessary for i in range(3): element = int(input()) list.append(element) #print the max value from the list and unpack it with the * print(max(*list))
14th Aug 2019, 8:57 PM
Rem Dy
Rem Dy - avatar
+ 1
Modified right
14th Aug 2019, 5:07 PM
Suresh