+ 2

IF I have three values o,m,n and I have wrote code,if m<n<o: print(m/o) but it's not working please tell me how to write it.

I'm making a E.F calculator

28th Apr 2021, 3:07 PM
Vaibhav Tiwari
15 Antworten
+ 1
The 3 more options are o<n<m, n<m<o, m<o<n
29th Apr 2021, 3:40 PM
ボリス
+ 8
But it works for float also.
28th Apr 2021, 3:26 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 8
Ur code works properly without showing an error. Maybe I guess problem is while when u are giving Input to it.
28th Apr 2021, 3:31 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 7
I don't know why it doesn't work for you as when I tried it worked. See this code: https://code.sololearn.com/cNqHqTx6ojDB/?ref=app
28th Apr 2021, 3:16 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 2
m<n and n<o Write like this
28th Apr 2021, 3:09 PM
YUGRAJ
+ 2
Thank you very much it worked
29th Apr 2021, 4:20 PM
Vaibhav Tiwari
+ 1
These are the inputs 57.8 3.6 38.6 12.0 1.0 16.0
28th Apr 2021, 3:34 PM
Vaibhav Tiwari
+ 1
Vishal Tiwari, it seems like there are other options as well (in addition to three you used in current if...else construction). If you add this row below, you will see, which values are not catched by your current if... elif construction. else: print(f"None of above:\n m = {m}\n n = {n}\n o = {o}")
29th Apr 2021, 2:32 PM
ボリス
+ 1
The amount of different orders of 3 values in a row is factorial of 3. This is calculated 3! = 6 (options). So you need to list 3 more options of the number order for your if...else construction. Also, what if some of the values are equal? E.g. m=o or n=m
29th Apr 2021, 2:45 PM
ボリス
0
I'm using float input
28th Apr 2021, 3:23 PM
Vaibhav Tiwari
0
I have tried but it's not like x=float(input()) y=float(input()) z=float(input()) a=float(input()) b=float(input()) c=float(input()) m=x/a n=y/b o=z/c if m<n<o: print(m/o) print(n/o) print(o/o)
28th Apr 2021, 3:28 PM
Vaibhav Tiwari
0
x=float(input()) y=float(input()) z=float(input()) a=float(input()) b=float(input()) c=float(input()) m=x/a n=y/b o=z/c if m<n<o: print(m/o) print(n/o) print(o/o) elif n<o<m: print(n/m) print(o/m) print(m/m) elif o<m<n: print(o/n) print(m/n)
28th Apr 2021, 3:42 PM
Vaibhav Tiwari
0
print(n/n)
28th Apr 2021, 3:42 PM
Vaibhav Tiwari
0
This is the complete code
28th Apr 2021, 3:43 PM
Vaibhav Tiwari
0
Thanks 😊 but I don't know how to do that 🙂 I'm still learning python begining
29th Apr 2021, 3:30 PM
Vaibhav Tiwari