- 博客(10)
- 收藏
- 关注
原创 字符串排序
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,
2024-01-09 13:43:00
360
原创 输入一个奇数,然后判断最少几个 9 除于该数的结果为整数
if __name__ == '__main__': zi = int(raw_input('输入一个数字:\n')) n1 = 1 c9 = 1 m9 = 9 sum = 9 while n1!= 0: if sum % zi == 0: n1 = 0 else: m9 *= 10 sum += m9 c9 += 1 print '%d 个 9 可以被 %d 整除 : %d' % (c9,zi,sum) r = sum / zi print '%d / %d = %d' % (sum,zi,r)
2024-01-09 13:42:03
401
原创 输入3个数a,b,c,按大小顺序输出
if __name__ == '__main__':n1 = int(raw_input('n1 = :\n'))n2 = int(raw_input('n2 = :\n'))n3 = int(raw_input('n3 = :\n'))def swap(p1,p2):return p2,p1if n1 > n2 : n1,n2 = swap(n1,n2)if n1 > n3 : n1,n3 = swap(n1,n3)if n2 > n3 : n2,n3 = swap(n2,n3)print n1,n2,n
2024-01-09 13:17:57
326
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人