0
Why my code giving me wrong answer or is something wrong with my code?
I just want to fetch small value but when i try it with third value it doesn’t work as i want and it should - first_num = int(input("input first number : ")) second_num = int(input("input second number : ")) third_num = int(input("input third number : ")) small_value = 0 if first_num < second_num and third_num : small_value = first_num elif second_num < first_num and third_num: small_value = second_num elif third_num < first_num and second_num: small_value = third_num print(small_value) output -> input first number : 5 input second number : 6 input third number : 3 5
4 Antworten
+ 8
Balraj Singh , you can not use conditional statement like this:
if first_num < second_num and third_num : # <<<<<<<
it has to be this way for all conditionals:
if first_num < second_num and first_num < third_num : # <<<<<<
+ 2
What are you expecting ?like the inputs and output .
+ 1
when I input third value as smallest value then it should print third value but it is not working that way. (Thanks for Reply Abhay )
+ 1
Thank You so much Lothar. it worked this way. 😊