题目内容

补充程序,实现计算如下数列的值:1-2+3-4...966s = 0count = 1while count <=966: if ______ : s -= count else: s += count count += 1print(s)

查看答案
更多问题

补充程序,采用字符串方式打印可以动态变化的文本进度条,进度条需要能在一行中逐渐变化。 import timescale=50start=time.perf_counter()print("执行开始".center(scale//2,'-'))for i in range(scale+1): a="*"*i b='.'*(100-i) c=i/100*100 t=______ -start print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,t),end='') time.sleep(0.1)print("\n"+"执行结束".center(scale//2,'-'))

补充程序,编程实现输出txt文本所有可能的分词结果。import jiebatxt = "中华人民共和国万岁!"ls = ______ (txt, cut_all=True).print(ls)

补充程序,编写“石头‘,’剪刀‘,’布’游戏,电脑随机选择“石头”、“剪刀”或者“布”,用户循环输入“石头”、“剪刀”或者“布”,如果赢了,则输出“你赢了,恭喜!”,并结束游戏。输入格式随机数种子设置为0‪‪‪‪‪‪‫‪‪‪‪‪‪‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‪。‪‪‪‪‪‪‫‪‪‪‪‪‪‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‪‫import randomrandom.seed(0)list1 = ['石头','剪刀','布']tag = 1 while tag: people = input("猜拳游戏:请输入石头、剪刀或布:") computer = ______ if people == computer: print('平局,再来!') elif(people == '石头' and computer == '剪刀') or (people == '剪刀' and computer == '布') or (people == '布' and computer == '石头'): print('你赢了,恭喜! ') tag = 0 else: print('你输了,哈哈哈哈!')

补充程序,实现如下函数返回两个数的平方和。 def psum(a, b): ______ a**2 + b**2a=eval(input())b=eval(input())print(psum(a,b))

答案查题题库