pythonExample100/JCP005.py

14 lines
349 B
Python
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

'''
【程序5】
题目输入三个整数x,y,z请把这三个数由小到大输出。
1.程序分析我们想办法把最小的数放到x上先将x与y进行比较如果x>y则将x与y的值进行交换
      然后再用x与z进行比较如果x>z则将x与z的值进行交换这样能使x最小。
2.程序源代码:
'''
l = []
for i in range(3):
x = int(raw_input('integer:\n'))
l.append(x)
l.sort()
print l