pythonExample100/JCP022.py

17 lines
726 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.

'''
【程序22】
题目两个乒乓球队进行比赛各出三人。甲队为a,b,c三人乙队为x,y,z三人。已抽签决定
   比赛名单。有人向队员打听比赛的名单。a说他不和x比c说他不和x,z比请编程序找出
   三队赛手的名单。
1.程序分析判断素数的方法用一个数分别去除2到sqrt(这个数),如果能被整除,
      则表明此数不是素数,反之是素数。       
2.程序源代码:
'''
for i in range(ord('x'),ord('z') + 1):
for j in range(ord('x'),ord('z') + 1):
if i != j:
for k in range(ord('x'),ord('z') + 1):
if (i != k) and (j != k):
if (i != ord('x')) and (k != ord('x')) and (k != ord('z')):
print 'order is a -- %s\t b -- %s\tc--%s' % (chr(i),chr(j),chr(k))