+ 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
15 ответов
+ 1
The 3 more options are o<n<m, n<m<o, m<o<n
+ 8
But it works for float also.
+ 8
Ur code works properly without showing an error.
Maybe I guess problem is while when u are giving Input to it.
+ 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
+ 2
m<n and n<o
Write like this
+ 2
Thank you very much it worked
+ 1
These are the inputs
57.8
3.6
38.6
12.0
1.0
16.0
+ 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}")
+ 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
0
I'm using float input
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)
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)
0
print(n/n)
0
This is the complete code
0
Thanks 😊 but I don't know how to do that 🙂 I'm still learning python begining