标签:猜数字 space 随机 The 打印 alpha 设计 99乘法表 bre
sum=0
for i in range(1,100,2):
print(i)
sum=sum+i
print(‘奇数和为:%s‘%(sum))
sum=0
for i in range(0,101,2):
print(i)
sum=sum+i
print(‘偶数和为:%s‘%(sum))
for i in range(1,10):
for j in range(i,10):
print(‘%s*%s=%d‘ % (i, j, i * j), end=‘ ‘)
print(‘ ‘)
import random
secretNum = random.randint(1,20)
import random
secretNum = random.randint(1,20)
print("这是一个位于 1-20 之间的数")
for number in range(1,4):
print("请输入猜测的数:")
guess = int(input())
if guess == 0:
break
if guess < secretNum:
print("太小啦")
elif guess > secretNum:
print("太大啦")
else:
break
if(guess == secretNum):
print("真厉害,猜对啦,就是",str(guess))
else:
print("很遗憾,正确的答案应该是",str(secretNum))
def count(s):
alpha,num,space,other=0,0,0,0
for i in s:
if i.isalpha():
alpha+=1
else:
other+=1
print(‘英文字符数{}‘.format(alpha,num,space,other))
count(input("请输入一个字符串:"))
s=input(‘请输入字符串:‘)
temp=list(s)
temp.reverse()
print(‘‘.join(temp))
标签:猜数字 space 随机 The 打印 alpha 设计 99乘法表 bre
原文地址:https://www.cnblogs.com/wwyydd/p/14244969.html