Python 练习实例79

简介: Python 练习实例79

题目:字符串排序。

程序分析:无。

实例(Python 2.0+)

#!/usr/bin/python# -*- coding: UTF-8 -*- if __name__ == '__main__':     str1 = raw_input('input string:\n')    str2 = raw_input('input string:\n')    str3 = raw_input('input string:\n')    print str1,str2,str3         if str1 > str2 : str1,str2 = str2,str1    if str1 > str3 : str1,str3 = str3,str1    if str2 > str3 : str2,str3 = str3,str2      print 'after being sorted.'    print str1,str2,str3

以上实例输出结果为:

input string:

abcde

input string:

efdis

input string:

adk

abcde efdis adk

after being sorted.

abcde adk efdis

相关文章
|
3天前
|
Python
Python 练习实例94
Python 练习实例94
|
5天前
|
数据可视化 Python
Python绘制基频曲线——实例解析与应用探讨
Python绘制基频曲线——实例解析与应用探讨
30 9
|
3天前
|
Python
Python 练习实例92
Python 练习实例92
|
3天前
|
Python
Python 练习实例93
Python 练习实例93
|
2天前
|
Python
Python 练习实例97
Python 练习实例97
|
2天前
|
Python
Python 练习实例96
Python 练习实例96
|
5天前
|
Python
Python 练习实例86
Python 练习实例86
|
4天前
|
Python
Python 练习实例90
Python 练习实例90
|
4天前
|
数据安全/隐私保护 Python
Python 练习实例89
Python 练习实例89
|
5天前
|
Python
Python 练习实例87
Python 练习实例87