Здравствуйте, начал изучать Python, изучил как работает инструкция if-else, решил написать маленькую программку для вычисления наибольшего из 3х чисел, дабы попрактиковаться.
Код:
#!/usr/bin/env python
#coding=utf-8
a=raw_input('a=')
b=raw_input('b=')
c=raw_input('c=')
if a<=b<c:
print c
raw_input('press enter to exit')
exit()
else:
if b<=a<c:
print c
raw_input('press enter to exit')
exit()
else:
if a<b<=c:
print c
print b
raw_input('press enter to exit')
exit()
else:
if b<=a<=c:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
if b<a<=c:
print a
print c
raw_input('press enter to exit')
exit()
else:
if c<=b<a:
print a
raw_input('press enter to exit')
exit()
else:
if b<=c<a:
print a
raw_input('press enter to exit')
exit()
else:
if c<b<=a:
print a
print b
raw_input('press enter to exit')
exit()
else:
if b<=c<=a:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
if b<c<=a:
print a
print c
raw_input('press enter to exit')
exit()
else:
if a<=c<b:
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<b:
print b
raw_input('press enter to exit')
exit()
else:
if a<c<=b:
print c
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<=b:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
if b<c<=a:
print a
print c
raw_input('press enter to exit')
exit()
else:
if a<=c<b:
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<b:
print b
raw_input('press enter to exit')
exit()
else:
if a<c<=b:
print c
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<=b:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
if b<a<=c:
print a
print c
raw_input('press enter to exit')
exit()
else:
if c<=b<a:
print a
raw_input('press enter to exit')
exit()
else:
if b<=c<a:
print a
raw_input('press enter to exit')
exit()
else:
if c<b<=a:
print a
print b
raw_input('press enter to exit')
exit()
else:
if b<=c<=a:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
if b<c<=a:
print a
print c
raw_input('press enter to exit')
exit()
else:
if a<=c<b:
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<b:
print b
raw_input('press enter to exit')
exit()
else:
if a<c<=b:
print c
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<=b:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
if b<c<=a:
print a
print c
raw_input('press enter to exit')
exit()
else:
if a<=c<b:
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<b:
print b
raw_input('press enter to exit')
exit()
else:
if a<c<=b:
print c
print b
raw_input('press enter to exit')
exit()
else:
if c<=a<=b:
if a==b==c:
print c
print b
print c
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
else:
c<a<=b
print a
print b
raw_input('press enter to exit')
exit()
Всё работает, но результат не всегда верно выдает..
Например:
a=1
b=2
c=3
3- все верно.
a=3
b=2
c=1
3- опять ОК.
НО:
a=324
b=9776
c=534343
9776- не верно……
странно как- то, подскажите, кто- нибудь.
