a=input("请输入一串单词:")
list1=a.split(',')
list1.sort()
print(','.join(list1))
year=int(input('请输入年:'))
month=int(input('请输入月:'))
day=int(input('请输入日:'))
months = (0,31,59,90,120,151,181,212,243,273,304,334)
if 1<= month <=12:
s=months[month-1]
else:
print('输入错误,已经退出')
s+=day
if(year%400==0) or (year%4==0 and year%100!=0):
if(month>2):
s+=1
print('这是%d年的第%d天' % (year,s))#格式化输出2个或2个以上数字的时候,注意输出格式
a=input('请输入a:')
b=input('请输入b:')
c=input('请输入c:')
list1=[]
list1.append(a)
list1.append(b)
list1.append(c)
list1.sort()
print(list1)
for i in range(1,6):
for j in range(1,i+1):
print('*',end=' ')
print('\n')
for i in range(1,10):
for j in range(1,i+1):
print('%d * %d = %d' % (i,j,i*j),end=' ')
print('')#在python中的print()有自动换行的功能,若再加换行符‘\n’,则会自动换2行
import math
t=1
for i in range(101,201):
k=int(math.sqrt(i))
for j in range(2,k+1):
if i % j ==0:
t=0
break
if(t==1):
print(i,end=' ')
t=1
for i in range(100,1000):
a=i%10
b=i//10%10
c=i//100
if(a*a*a+b*b*b+c*c*c==100*c+10*b+a):
print(i,end=' ')
n=int(input('请输入一个数:'))
l=[]
while n!=1:
for i in range(2,n+1):
if n%i ==0:
str='%s' % i
l.append(str)
n=n//int(str)
l.sort()
print('*'.join(l))
score = int(input('input score:'))
if score >= 90:
grade = 'A'
elif score >= 60:
grade = 'B'
else:
grade = 'C'
print ('%d belongs to %s' % (score,grade))
import string
s = input('input a string:')
letters = 0#统计英文字母的个数
space = 0#统计空格的个数
digit = 0#统计数字的个数
others = 0#统计其他字符的个数
for c in s:
if c.isalpha():#统计英文字母
letters += 1
elif c.isspace():#统计空格
space += 1
elif c.isdigit():#统计数字
digit += 1
else:
others += 1
print ('char = %d,space = %d,digit = %d,others = %d' % (letters,space,digit,others))